Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.6.0
Description
Some ST functions that transform geometry to geometry do not preserve the SRID of the input geometry. For instance:
SELECT ST_SRID(ST_Collect(ST_GeomFromText('POINT (10 20)', 1000))) +---------------------------------------------------------+ |st_srid(st_collect(st_geomfromtext(POINT (10 20), 1000)))| +---------------------------------------------------------+ | 0| +---------------------------------------------------------+
While some other functions do preserve the SRID of the input geometry:
SELECT ST_SRID(ST_Buffer(ST_GeomFromText('POINT (10 20)', 1000), 1)) +-----------------------------------------------------------+ |st_srid(st_buffer(st_geomfromtext(POINT (10 20), 1000), 1))| +-----------------------------------------------------------+ | 1000| +-----------------------------------------------------------+
Additionally, ST_Transform should alter the SRID of the output geometry, but it preserves the SRID of the input geometry:
sedona.sql("SELECT ST_SRID(ST_Transform(ST_GeomFromText('POINT (10 20)', 3857), 'EPSG:4326'))").show() +----------------------------------------------------------------------+ |st_srid(st_transform(st_geomfromtext(POINT (10 20), 3857), EPSG:4326))| +----------------------------------------------------------------------+ | 3857| +----------------------------------------------------------------------+
User has to put ST_SetSRID everywhere when they want geometries with proper SRIDs.
Attachments
Issue Links
- links to