[postgis-devel] ST_Segmentize geography go back to old 2.2 behavior

Regina Obe lr at pcorp.us
Fri Sep 22 07:22:23 PDT 2017


I like that idea except that would require proj 4.9 or above which is not required at least for 2.4.

I'm okay with living with this bug for 2.4, and maybe in PostGIS 2.5 we rewrite it and make Proj 4.9 a minimum requirement.

Requiring Proj 4.9 will also take care of the annoying behavior that our geography functions are more robust if you have proj 4.9 or above and lower folks often complain about issues that aren't present for a 4.9 install.

Thanks,
Regina

-----Original Message-----
From: postgis-devel [mailto:postgis-devel-bounces at lists.osgeo.org] On Behalf Of Mike Toews
Sent: Friday, September 22, 2017 2:44 AM
To: PostGIS Development Discussion <postgis-devel at lists.osgeo.org>
Subject: Re: [postgis-devel] ST_Segmentize geography go back to old 2.2 behavior

On 22 September 2017 at 07:47, Regina Obe <lr at pcorp.us> wrote:
> Except for this last one which I propose we fix by switching back to 
> 2.2 behavior.  The new behavior is harder to get right in all cases 
> and I don't see it as being that much of an improvement over the old behavior.

I'll admit that I haven't been following the old or new behaviours of ST_Segmentize, but I'd suggest redesigning this based on GeographicLib (same library used for ST_Distance, via PROJ), since it has reliable methods to do parts of the technique. In particular, it will produce equal-length sub-segments, probably within a few nanometres.

Charles has a few examples of interpolating points from an inverse geodesic line, here is one for C:
https://geographiclib.sourceforge.io/html/C/geodesic_8h.html#a0b91285fb3cd572d2d77b2e062e8c800

Essentially, you create an geod_geodesicline for each vertex pair, find the geodesic length (s12). If the geodesic segment length is greater than the segmentize distance, then interpolate the points along the geodesic line with geod_position by dividing s12 by the appropriate number of points required. Each sub-segment would have equal distance between them.

As for performance, creating each geod_geodesicline is just as expensive as ST_Distance (2.62  s), then geod_position to get the interpolated points is very cheap (each 0.37  s).

Cheers, Mike
_______________________________________________
postgis-devel mailing list
postgis-devel at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-devel




More information about the postgis-devel mailing list