Hi,

I've committed recently a small improvement regarding vector and attribute 
tables in the 
GeoPackage driver, so as to get the number of features quickly. This can be 
interesting when 
dealing with huge tables. Without that, getting the number of features require 
a full table 
scan. So I've added a "ogr_feature_count" column to the gpkg_contents table, 
and triggers to 
update it.
To my understanding, such an extension is allowed by the specification.
While running through the OGR GPKG driver those triggers are temporarily 
disabled during 
feature insertion and deletion so as to make them faster, and restored back at 
dataset 
closing.
The driver of course behaves well if the column is missing or if its content is 
NULL (will revert 
to full table scan to get feature count)
Earlier versions of the OGR GPKG driver are also happy with the new layout of 
the DB.
As a provision, I've added a ADD_OGR_FEATURE_COUNT_COLUMN=NO dataset creation 
option to disable this, but it is my hope this will be not needed.

So I'd be interested if people could test 
http://even.rouault.free.fr/geopackage/ne_10m_admin_0_countries_france.gpkg
(or any other gpkg you may generate with today's ogr2ogr) with other software 
package that 
don't use OGR underneath (ArcGIS for example).

Suggested tests:
- check that the DB opens well and the layer is listed
- check that the layer opens well (you should see France and its overseas 
territories)
- check that you can add or delete features to the layer. Check afterwards that 
the 
ogr_feature_count is well updated (it should, thanks to the triggers):
ogrinfo ne_10m_admin_0_countries_france.gpkg \
   -sql "select * from gpkg_contents"

- check that you can add a new layer to the DB (ie insertion of new content in 
gpkg_contents 
works well, despite the new column added). The value of the ogr_feature_count 
column 
should be NULL.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to