I am not suggesting geographiclib is a bad choice. It may well be the fastest and most efficient implementation out there for doing geodesic calculations. It is just that the current PostGIS Help documentation clearly suggests that switching to sphere based calculations can improve performance at the obvious cost of some less accuracy. And of course it would be interesting to know if a true sphere based implementation could be faster, but maybe nobody bothered to implement one as it can be a special case of spheroidal, IDK?

It would also be interesting to know if PostGIS uses the 'Geodesic' or 'GeodesicExact' class of geographiclib (or corresponing option on the 'PolygonAreaT' class). It is likely the former as it is well documented to be faster, but if not due to a possible need to properly support larger values of flattening, switching to 'Geodesic' or exposing the option to switch between 'Geodesic' and 'GeodesicExact' in PostGIS, might be an option. However, I have no idea in what situations using 'GeodesicExact' and larger flattening values is necessary, and if 'GeodesicExact' is a real world use case in common scenario's.

Op 2-10-2024 om 12:37 schreef Greg Troxel:
Is there data that suggests the geographiclib calculation is taking
longer than some other code might?  There's a lot going on in postgis,
and without a benchmark showing it's an issue, it feels like it could be
premature optimization.

Reply via email to