[OSM-dev] Area calculation without transformation
Even Rouault
even.rouault at spatialys.com
Sun Mar 24 21:28:17 UTC 2024
Hi,
if you use GDAL, you have already the PROJ dependency. So if you install
PROJ development headers and include "geodesic.h" and use the
geod_polygonarea() function, or geod_polygon_compute(), which is what
PostGIS uses under the hood to implement ST_Area() on spheroid at
https://github.com/postgis/postgis/blob/c25c64341c5a31ecb0bbcd17740bb000bd9cf759/liblwgeom/lwspheroid.c#L142
An alternative is to use Spatialite's ST_Area(surface_geom,
/*use_ellipsoid=*/1) function, but that requires libspatialite to have
been built against librttopo, which isn't a common setup.
Seeing all that, I've just queued enhancements in GDAL related to all
the above: https://github.com/OSGeo/gdal/pull/9552
Even
Le 24/03/2024 à 15:44, Florian Lohoff a écrit :
> Hi,
>
> I am looking into performance issued with QA code of mine and i am at one
> point i calculate the osm objects area.
>
> I am using libosmium and gdal/OGR right now.
>
> Now - to get a m² based area i am transforming into an planar EPSG
> which seems to be the bottleneck of processing.
>
> I now had a quick look at postgis'es lwgeom code for ST_Area using
> a spheroid which my guess is much faster as i am on the very same spheroid
> all the time.
>
> Does anyone know of a c++ implementation nicely plugging into
> libosmium/gdal/ogr processing just using the EPSG:4326?
>
> Flo
>
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/dev
--
http://www.spatialys.com
My software is free, but my time generally not.
More information about the dev
mailing list