Bod has asked for the wisdom of the Perl Monks concerning the following question:
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' };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Geo Package files
by soonix (Chancellor) on Mar 03, 2022 at 15:33 UTC | |
by Bod (Parson) on Mar 03, 2022 at 23:36 UTC | |
by soonix (Chancellor) on Mar 04, 2022 at 20:39 UTC | |
by Marshall (Canon) on Mar 04, 2022 at 22:46 UTC | |
by Marshall (Canon) on Mar 04, 2022 at 19:52 UTC | |
by Bod (Parson) on Mar 05, 2022 at 00:58 UTC | |
by Marshall (Canon) on Mar 05, 2022 at 04:19 UTC | |
| |
by hv (Prior) on Mar 05, 2022 at 14:21 UTC | |
by Bod (Parson) on Mar 12, 2022 at 19:16 UTC | |
by Marshall (Canon) on Mar 12, 2022 at 20:12 UTC | |
|
Re: Geo Package files
by swl (Prior) on Mar 04, 2022 at 00:30 UTC | |
by Bod (Parson) on Mar 04, 2022 at 00:57 UTC | |
by swl (Prior) on Mar 04, 2022 at 01:23 UTC | |
by Fletch (Bishop) on Mar 05, 2022 at 03:21 UTC | |
by Bod (Parson) on Mar 05, 2022 at 13:45 UTC | |
by Fletch (Bishop) on Mar 05, 2022 at 22:56 UTC | |
by Marshall (Canon) on Mar 08, 2022 at 03:35 UTC | |
|