[gdal-dev] 3D extent

Even Rouault even.rouault at spatialys.com
Fri Jun 23 02:25:58 PDT 2023


Benoit,

Indeed OGR_L_GetExtent() will never fill the Z fields, since it has no 
idea they are there. So a 3D specific function would be needed.

But in the case of GeoPackage, as many/most other formats, layer extent 
metadata doesn't include the Z component either. The generic option is 
to iterate over all features and use OGR_G_GetEnvelope3D() on their 
geometry.

In the specific case of GeoPackage, you could also issue a 
ExecuteSQL("SELECT MIN(ST_MinZ(geometry_column_name)), 
MAX(ST_MaxZ(geometry_column_name)) FROM layer_name") which should be 
faster on big layers

Even

Le 23/06/2023 à 11:14, B. De Mezzo a écrit :
>
> Hi,
>
> I was looking for a solution to retrieve a 3D extent (in my case from 
> a gpkg). Currently, the OGR_L_GetExtent function uses an OGREnvelope 
> and when I pass a OGREnvelope3D parameter, it does not fill the Z fields.
>
> What should be the best approach to the minZ and maxZ for a layer?
>
> Regards.
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230623/32cc2932/attachment.htm>


More information about the gdal-dev mailing list