[postgis-tickets] [PostGIS] #3728: Bug in geography ST_Segmentize
PostGIS
trac at osgeo.org
Fri Mar 10 22:03:55 PST 2017
#3728: Bug in geography ST_Segmentize
----------------------+---------------------------
Reporter: petermj | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 2.3.3
Component: postgis | Version: 2.3.x
Resolution: | Keywords:
----------------------+---------------------------
Changes (by robe):
* cc: hmercier (added)
Comment:
Okay I see your point. I reduced the query to one offending example:
IN POSTGIS="2.3.2 r15302" GEOS="3.6.1-CAPI-1.10.1 r4317" PROJ="Rel. 4.9.1,
04 March 2015" GDAL="GDAL 2.1.3, released 2017/20/01" LIBXML="2.7.8"
LIBJSON="0.12" RASTER
{{{
With f AS (SELECT ST_Segmentize(ST_GeogFromText('SRID=4326;
LINESTRING(-4.0 49.8, -4.0 59.0)'),1000) AS geog_s,
ST_GeogFromText('SRID=4326; LINESTRING(-4.0 49.8, -4.0 59.0)') AS geog),
f2 AS (SELECT ST_NPoints(geog_s::geometry) AS geog_s_npoints, geog,
geog_s FROM F)
SELECT geog_s_npoints, ST_Length(geog_s) AS seg_length, ST_Length(geog)
AS orig_length, ST_Length(geog)/1000 As exp_np,
ST_Length(ST_MakeLine(ST_PointN(geog_s::geometry, 1),
ST_PointN(geog_s::geometry, 2))::geography) As first_seg_length,
ST_Length(ST_MakeLine(ST_PointN(geog_s::geometry, geog_s_npoints -
1), ST_PointN(geog_s::geometry, geog_s_npoints))::geography) As
last_seg_length
FROM f2;
}}}
Yields:
{{{
geog_s_npoints | seg_length | orig_length | exp_np |
first_seg_length | last_seg_length
----------------+------------------+-----------------+-----------------+------------------+------------------
894 | 1024067.47066481 | 1024067.4706648 | 1024.0674706648 |
1000.26657219012 | 131222.895347768
(1 row)
}}}
Answer in
POSTGIS="2.2.2 r14797" GEOS="3.6.1-CAPI-1.10.1 r4317" PROJ="Rel. 4.9.1, 04
March 2015" GDAL="GDAL 2.1.3, released 2017/20/01" LIBXML="2.7.8"
LIBJSON="0.12" RASTER
{{{
geog_s_npoints | seg_length | orig_length | exp_np |
first_seg_length | last_seg_length
----------------+-----------------+-----------------+-----------------+------------------+------------------
1024 | 1024067.4706648 | 1024067.4706648 | 1024.0674706648 |
995.986340600015 | 997.506446092082
(1 row)
}}}
Much more pleasant indeed.
SO yes this looks like another regression resulting from the 2.3
segmentize change.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3728#comment:2>
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