[gdal-dev] Testing of OGR generated GeoPackage datasets with other implementations
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.
MapInfo did not give any error message, it just does not find any layers and quits. I could not find anything like error log from MapInfo directory. I will send a message to MapInfo support as well with a link to your geopackage.
Right, ne_10m_admin_0_countries_france_no_ogr_feature_count.gpkg opens with MapInfo 15.2.
Lähettäjä: Even Rouault [mailto:[hidden email]]
Lähetetty: 2. maaliskuuta 2017 15:49 Vastaanottaja:[hidden email] Kopio: Rahkonen Jukka (MML) <[hidden email]> Aihe: Re: [gdal-dev] Testing of OGR generated GeoPackage datasets with other implementations
On jeudi 2 mars 2017 06:36:06 CET jratike80 wrote:
Note: I've just refreshed it to add triggers since my inital upload.
ogrinfo ne_10m_admin_0_countries_france_alternative.gpkg -sql "CREATE TRIGGER trigger_insert_ogr_feature_count_ne_10m_admin_0_countries AFTER INSERT ON ne_10m_admin_0_countries BEGIN UPDATE gpkg_ogr_contents SET feature_count = feature_count + 1 WHERE table_name = 'ne_10m_admin_0_countries'; END"
ogrinfo ne_10m_admin_0_countries_france_alternative.gpkg -sql "CREATE TRIGGER trigger_delete_ogr_feature_count_ne_10m_admin_0_countries AFTER DELETE ON ne_10m_admin_0_countries BEGIN UPDATE gpkg_ogr_contents SET feature_count = feature_count - 1 WHERE table_name = 'ne_10m_admin_0_countries'; END"