Opened 10 years ago

Closed 10 years ago

#5335 closed enhancement (fixed)

GPKG driver for OGR

Reported by: pramsey Owned by: pramsey
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords: geopackage
Cc: Even Rouault

Description

Adds "geopackage" support for OGR. Separate from the SQLite driver, for better or worse (there's a lot going on in there) but uses same SQLite detection from autoconf. Basic implementation, requires improved spatial filter support (the "index" extension in the GPKG standard) still, but passes ogr tests and has a small/ auto test suite.

Attachments (2)

gpkg_autotest_1.patch (13.4 KB ) - added by pramsey 10 years ago.
gpkg_gdal_1.patch (115.3 KB ) - added by pramsey 10 years ago.

Download all attachments as: .zip

Change History (14)

by pramsey, 10 years ago

Attachment: gpkg_autotest_1.patch added

by pramsey, 10 years ago

Attachment: gpkg_gdal_1.patch added

comment:1 by pramsey, 10 years ago

Work can also be reviewed on github at https://github.com/pramsey/gdal/tree/gpkg

comment:2 by pramsey, 10 years ago

Cc: evenr added; event removed

comment:3 by Even Rouault, 10 years ago

Cc: Even Rouault added; evenr removed

Actually my Trac login is "rouault".

Regarding autotest patch, there will be failures if SQLite is not available. There should be a "if gdaltest.gpkg_dr is None: return 'skip'" at the beginning of each function. You can try running the tests with OGR_SKIP=GPKG.

Regarding main patch,

  • the Windows makefiles are missing (actually moving the files from ogr/ogrsf_frmts/gpkg to ogr/ogrsf_frmts/sqlite would simplify that, and make a potential further unification with "standard" SQLite driver easier)
  • CheckApplicationId() might segfault if trying to open a .gpkg file that exists, but has not read permissions. The return value of VSIFOpenL() should be checked.
  • there are a few commented methods in ogr_geopackage.h
  • drv_geopackage.html seems to be in progress
  • the GetExtent() and GetFeatureCount() methods could likely be implemented be for efficient "ogrinfo the.gpkg -so -al"
  • Looking at base SQLite driver, I can see that we use "sqlite3_last_insert_rowid( hDB )" that seems shorter than the OGRGeoPackageLayer::GetLastFid() method.

comment:4 by pramsey, 10 years ago

Draft GPKG driver committed at r26860

Should support enough features for basic read/write usage.

comment:5 by pramsey, 10 years ago

Resolution: fixed
Status: newclosed

comment:6 by Even Rouault, 10 years ago

Resolution: fixed
Status: closedreopened

http://gisinternals.com/sdk/ shows that there's a breakage for MSVC builds. I can try fixing it with the current file structure, but I wanted to know if you plan letting the files in the gpkg subdirectory or move them in sqlite.

comment:7 by pramsey, 10 years ago

I was planning on leaving them in the gpkg subdirectory.

comment:8 by pramsey, 10 years ago

Trying a fix at r26862

comment:9 by Even Rouault, 10 years ago

Not sure if you saw my yesterday note on IRC : [02:14] <EvenR> pramsey: valgrind on ogr_gpkg.py indicates a few errors (use after free) and memory leaks [02:18] <EvenR> pramsey: here's the interesting extract of the valgrind log : https://gist.github.com/rouault/8532608

comment:10 by pramsey, 10 years ago

Attempt at memory cleansing at r26863. Unfortunately, valgrind is not available for OSX Mavericks under MacPorts (yet) so any help re-running, posting new results, much appreciated.

comment:11 by Even Rouault, 10 years ago

r26866 "GPKG: fix crash, memory error and memory leaks (#5335)"

comment:12 by Even Rouault, 10 years ago

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.