[postgis-users] New algorithms on the spheroid: intersecting lines and minimum distance point-line. Current software error assesment.

Paul Ramsey pramsey at cleverelephant.ca
Wed Jul 28 09:54:49 PDT 2021


This is very interesting, but from a practical point of view the problems
around doing intersections on the spheroid are not to do with the
difficulty of calculating spheroidal intersection points, but the
difficulty in programming things that are relatively simple in cartesian
(R2) space in spherical space (S2), like "is this point in this ring",
because the question of "what does this ring enclose" is quite different in
S2 than in R2. IE, the complexity of the problem does not reside in the
spheroidal geometry but in the spherical topology. Which is not to say that
it cannot be done, Google S2 has done a number of constructive geometry
functions in spherical space, but it's not just a matter of getting the
right intersection points.

I would be interested in direct comparisons between spheroidal and
spherical intersection, rather than comparisons with "whatever the heck
these tools use under the covers", which your survey shows is "quite a wide
variety of approaches".

Unfortunately although PostGIS has spherical intersection internally
(hilariously, I calculate it here [1] but never even let it out of the
function) it is not exposed to the end user. You could use Google S2 [2] to
generate spherical intersection points though, and compare those to
spheroidal.

The reason I ask is because comparison of spherical and spheroidal
*distances* never yield particularly large differences, always under 1%.
Now, spherical distances are not *right*, but they are also *not that
wrong* which is presumably why tools like S2 have eschewed finding
spheroidal intersections. Under the covers you'll find that the PostGIS
distance functions use spherical calculations to find the two points that
are closest between two geometries, and only then calculate the spheroidal
distance between those points.

Thanks for sharing your research,
Paul

[1]
https://github.com/postgis/postgis/blob/main/liblwgeom/lwgeodetic.c#L3596
[2] http://s2geometry.io/


On Tue, Jul 27, 2021 at 9:34 AM José Carlos Martínez <jomarlla at cgf.upv.es>
wrote:

> Hi list,
>
> I want to share our last research about gemetric operations on the
> spheroid [1]
>
> Considering two segments defined by 2 points each one over the spheroid.
> We want to get the intersection point defined by these two segments.
>
> Several points to note:
> 1.- We could not find any software (Oracle Spatial, ArcGIS, PostGIS,
> Google Apis) that performs this calculation on the ellipsoid: some use
> projected CRS, others just use a local sphere.
> 2.- The error comitted by these software is unknown.  And I go further,
> these unknown errors could be greater than the cartographic precision of
> my geo data? If so, all my geo spatial analysis could be wrong.
> 3.- We designed a new algorithm of fast convergence working on the
> spheroid. We can get the exact intersection point, therefore we can
> asses the error from the current software solutions.
> 4.- Example: working with segments around 50km length, the error is
> around 3 meters (PostGIS, ArcGIS). Table 4 from paper [2] shows the
> large error commited by Oracle Spatial, ArcGIS, and even PostGIS with
> local projected CRS (st_intersection with geography).
> 5.- This proposed algorithm is implemented as a test in PostGIS, Java
> and Maxima.
>
>
> Finally, mention that, in a normal computer, about 20,000 intersections
> per second have been obtained. Perhaps, now is the time to migrate
> certain geospatial libraries such as JTS (GEOS), GDAL, etc. so that they
> carry out the calculations in full on the ellipsoid and thus be able to
> forget about the projected CRS, and leave them purely for aesthetic
> purposes.
>
> I will be proud of helping the PostGIS or the JTS team to incorporate
> these geometric operations on the ellipsoid (could be the first spatial
> BDD or geospatial library to do that).
>
>
> Cheers,
>
> José
>
>
> All the information, source code, etc. here.
> [1]
>
> https://cartosig.webs.upv.es/2021/07/27/geodesic-intersection-proposed-algorithm-and-error-assessment-of-current-software/
>
> [2] https://www.mdpi.com/2076-3417/11/11/5129
>
> Martínez-Llario JC, Baselga S, Coll E. Accurate Algorithms for Spatial
> Operations on the Spheroid in a Spatial Database Management System.
> Applied Sciences. 2021; 11(11):5129. https://doi.org/10.3390/app11115129
>
> [3] https://link.springer.com/article/10.1007/s11200-017-1020-z
>
> Baselga, S., Martínez-Llario, J.C. Intersection and point-to-line
> solutions for geodesics on the ellipsoid. Stud Geophys Geod 62, 353–363
> (2018). https://doi.org/10.1007/s11200-017-1020-z
>
> [4] https://github.com/jomarlla/geodesicSpatialOperators
>
>
> --
> -------------------------------
> José Carlos Martínez Llario
> http://www.upv.es/ficha-personal/jomarlla
> https://cartosig.webs.upv.es
> Producción Cartográfica y SIG.
> Dpto. Ingeniería Cartográfica.
> Univ. Politécnica de Valencia.
> -------------------------------
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20210728/2fab5f94/attachment.html>


More information about the postgis-users mailing list