about GetShapefileExtent()
Not logged in

Back to 5.0.0-doc main page

about GetShapefileExtent()

Starting since version 5.0.0 libspatialite supports a new SQL function related to VirtualShape Tables that is specifically intended to quickly retrieve the Full Extent of the underlaying Shapefile.

Just a short recall about Shapefiles:
The new GetShapefileExtent() SQL function directly queries the full extent declared into the shapefile's header block, so it's expected to be very fast even when the shapefile contains an huge number of Features.


We'll start by creating a VirtualShape Table:
CREATE VIRTUAL TABLE test USING VirtualShape('./someshapefile', 'CP1252', 4326);
and now we are ready to check the VirualShape's Full Extent:
SELECT AsEWKT(GetShapefileExtent('test'));
SRID=4326;POLYGON((6.626621360000058 35.49285259200007,18.52038155300005 35.49285259200007,18.52038155300005 47.09178374200007,6.626621360000058 47.09178374200007,6.626621360000058 35.49285259200007))
Please note:
If two (or more) VirtualShapes exist within the same DB connection exactly sharing an identical Table-name (obviously, each one being located on a different ATTACHED-DB) the result returned by GetShapefileExtent() will be unpredictable.

Back to 5.0.0-doc main page