I suspect this is a bit of a longshot...but...
Has anyone had any dealings with reading a Geo Package .gpkg file using Perl. I cannot find anything in CPAN that might help.
A .gpkg file is a SQLite3 DB file. Of course, Perl can handle this. I have used DBD::SQLite to access the Geo Package. The file I am trying to use only has one layer so it only has one row in the gpkg_contents table. This defines the content I need as being in the openUSRN table.
I've used this code to peek at this table....
use DBD::SQLite; use Data::Dumper; use strict; use warnings; my $dbh = DBI->connect("dbi:SQLite:uri=file:osopenusrn_202203.gpkg?mod +e=rwc"); my $tab = $dbh->prepare("SELECT * FROM openUSRN"); $tab->execute; while (my $n = $tab->fetchrow_hashref) { print Dumper $n; }
There are four fields in the table. Three are human-readable text. However, the one I am most interested in, geometry, is gobbledegook. A quick look at the specification seems to show that it is not going to be trivial to work out how to decode this from scratch. So I am hopeful that someone has trodden this path before to give me a head start or even a solution.
I suspect that the geometry is actually a linestring. I am only interested in getting the co-ordinates of the start and the end of the linestring.
Here is a sample of the output...
$VAR1 = { 'geometry' => 'GP ♣4l ►Îú░ü~▬A ]m&# +9827;↓⌂▬A└¯╔├☼$→A^ +92;╚v■[$→A ☺Ý♥ ☻ + ☺Û♥ ☻ ]m♣↓⌂▬A└& +#9562;v■[$→A ░¡Ï▀¤~▬A└¯	 +556;├☼$→A ☺Û♥ ☻ ► +Îú░ü~▬A`©▲E+$→A ░¡Ï▀¤~` +44;A└¯╔├☼$→A ', 'usrn' => 2900534, 'id' => 1497, 'street_type' => 'Designated Street Name' };
In reply to Geo Package files by Bod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |