Do you know where your variables are? | |
PerlMonks |
Re: Geo Package filesby swl (Parson) |
on Mar 04, 2022 at 00:30 UTC ( [id://11141817]=note: print w/replies, xml ) | Need Help?? |
You can use Geo::GDAL::FFI to read the contents of a geopackage (untested example code below). The geometry field is stored as Well Known Binary (WKB), or perhaps a variant of it. This can be converted to Well Known Text (WKT) to be human readable. A definition of WKB is given in the libgeos docs at https://libgeos.org/specifications/wkb, and WKT at https://libgeos.org/specifications/wkt/. The GDAL stack can be a beast to install if the aliens have to compile everything from source (GDAL, Proj, GEOS, libtiff, libsqlite3, optionally also spatialite, freexl and curl). If you are on a unix type machine then install the gdal-dev package using your system package manager, then the GDAL aliens will run system installs. Example code:
Update: More details of the geopackage geometry format are at http://www.geopackage.org/spec131/index.html#gpb_format. This should be of use if you decide to write your own parser to extract the first and last coordinates of each linestring.
In Section
Seekers of Perl Wisdom
|
|