[postgis-tickets] [PostGIS] #3941: ST_Segmentize() wraps geography coordinates on dateline

PostGIS trac at osgeo.org
Thu Dec 14 14:06:31 PST 2017


#3941: ST_Segmentize() wraps geography coordinates on dateline
-----------------------------------+---------------------------
 Reporter:  francoisb              |      Owner:  pramsey
     Type:  defect                 |     Status:  new
 Priority:  medium                 |  Milestone:  PostGIS 2.4.3
Component:  postgis                |    Version:  2.4.x
 Keywords:  densify densification  |
-----------------------------------+---------------------------
 Points exactly on the dateline have two valid representations in the
 geography type:

 {{{
 SELECT
   ST_GeomFromText('POINT(-180 0)')::geography AS negative,
   ST_GeomFromText('POINT( 180 0)')::geography AS positive;
 }}}

 Gives:

 {{{
 negative | 0101000020E610000000000000008066C00000000000000000
 positive | 0101000020E610000000000000008066400000000000000000
 }}}

 Internally these are two different values, but semantically it corresponds
 to the same location.

 ST_Segmentize() unfortunately uses this fact to modify input geography.
 ST_Segmentize() is supposed to only add vertices, but it happens it may
 also modify given ones. Example:

 {{{
 SELECT ST_AsText(ST_Segmentize(
   ST_GeomFromText('LINESTRING(-180 0, -179 0)')::geography,
   5e4
 ));
 }}}

 Actual:

 {{{
 LINESTRING(180 0,-179.75 0,-179.5 0,-179.25 0,-179 0)
 }}}

 Note the positive 180, changed from input.

 Expected:

 {{{
 LINESTRING(-180 0,-179.75 0,-179.5 0,-179.25 0,-179 0)
 }}}

 Note the negative -180, unchanged from input.

 A point represented with longitude -180 in the input geography should
 remain with this -180 value, and not change to +180.

 Setup:

 {{{
 SELECT postgis_full_version();

 POSTGIS="2.4.2 r16113" PGSQL="100" GEOS="3.6.2-CAPI-1.10.2 4d2925d6"
 PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 1.11.5, released 2016/07/01"
 LIBXML="2.9.7" LIBJSON="0.12.1" TOPOLOGY RASTER
 }}}

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3941>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list