Skip to content

The GeoPackage branch

Andrea Aime edited this page Apr 22, 2020 · 5 revisions

The geopackage branch contains a variant of the configuration where both the low and high resolution datasets are stored in GeoPackage files. This is good for self-contained tests and in general for smaller areas (e.g., single state).

Getting started with a sample GeoPackage

Want to give the data directory a spin without having to go through the OSM data import? No problem, we got you covered with a sample dataset from New York.

Basically:

  • Clone the GeoPackage branch, which will be used as the data directory
  • Run all steps in the main README, with the exclusion of the the imposm part.
  • In addition to the osm-lowres.gpkg file, download osm-ny.gpkg and place it too in the data subfolder, on the side of osm-lowres.gpkg.
  • Start GeoServer. It should be working out of the box.

Creating your GeoPackage

In order to create the high resolution OSM file (in the data dir osm-ny.gpkg) one should import the data into PostGIS as usual, as imposm only targets that data store at the moment.

One can then export into a GeoPackage using ogr2gr, e.g.:

 ogr2ogr  -f GPKG osm.gpkg PG:'dbname=osm_styles schemas=import'

The database as generated won't work with the pregeneralized store due to column mis-aligned, the generalized tables miss the "id" column. SQLite does not allow dropping the useless column in the base tables, the following script can be used to align the overview tables structure instead:

alter table osm_landusages_gen0 add column id int;
alter table osm_landusages_gen1 add column id int;
alter table osm_roads_gen0 add column id int;
alter table osm_roads_gen1 add column id int;
alter table osm_roads_gen2 add column id int;
alter table osm_roads_gen3 add column id int;
alter table osm_waterareas_gen0 add column id int;
alter table osm_waterareas_gen1 add column id int;
alter table osm_waterways_gen0 add column id int;
alter table osm_waterways_gen1 add column id int;

A more sophisticated export ogr2ogr export script could be used to skip the id columns in the base structure instead. If you build one, let us know, we'll share it in this page.