In response to repeated customer requests seeking spatial datasets based on the OpenStreetMap service, CYBERTEC decided to start an initiative to address this demand.
Table of Contents
CYBERTEC implemented a "download OpenStreetMap" service which periodically generates extracts of OpenStreetMap data in various forms, and outputs the data as an sql dump to streamline and simplify its usage. Extracts cover a particular region of interest-- typically, aligned with the boundaries of countries or continents. We already set extract imports’ parameters for your convenience. Import variants implicitly state how your dataset was imported into our database. New variants can be created according to your wishes, contact us for more details.
The main entry point of our service, which is free of charge, is located at https://gis.cybertec-postgresql.com/.
Importing OpenStreetMap data into PostGIS
can be a hard and time-consuming task. To simplify this process and speed up the import, we decided to kick off a service offering two dataset types, periodically served as sql dumps.
pbfs
.The first type of import variant is drawn from the main objective of OpenStreetMap, which is to solve spatial questions by analyzing and visualizing spatial data. There are endless ways to import and map OSM data to PostGIS in order to serve this purpose. To support most typical use cases while retaining flexibility, we decided to implement a generic import like that of OpenStreetMap Carto (https://github.com/gravitystorm/openstreetmap-carto). Incidentally, this enables us to use this dump seamlessly as a source for tiling services, such as https://switch2osm.org/serving-tiles/ or https://github.com/Overv/openstreetmap-tile-server.
A brief description of the import chain can be found at https://gis.cybertec-postgresql.com/osmtile/readme.txt.
The second type of import variant addresses the demand to solve various kinds of routing-related questions. This time, import native datasets utilizing osm2po
(https://osm2po.de/), a great java application which turns pure OpenStreetMap data into a routable graph. Ideally, the resulting table will be used together with pgRouting
(https://pgrouting.org/), another terrific extension which brings geospatial routing functionality to PostgreSQL.
Checkout the import chain at https://gis.cybertec-postgresql.com/osmrouting/readme.txt.
CYBERTEC offers extracts for the whole world. Since we don't see the need to re-invent the wheel, we align datasets' spatial extents with the boundaries of countries or continents. To simplify access and downloads, we structured the datasets hierarchically, as stated in figure 1.
Dataset hierarchy
How often will our datasets be generated? We generate native extracts (pbfs
) daily, and produce dumps 1 to 2 times per month. Currently, we try to optimize the whole process to provide more frequent current dumps for our customers.
So how can customers use our service? Let’s go through a typical customer scenario.
A customer plans to set up a tiling server which offers raster data covering Austria. Let’s assume tiling infrastructure is already up and running, however the missing link is a database containing OpenStreetMap data. Instead of utilizing osm2pgsql
to import the dataset, the customer can take a nice shortcut and directly download the appropriate sql dump from our service ????.
First, head to https://gis.cybertec-postgresql.com/ and choose your region of interest. Figure 2 shows available datasets for Austria at the present time. Since we want to setup a tiling service, our dataset import variant of choice is “Analysis, Tiling”. Let’s download the latest dump for this region from https://gis.cybertec-postgresql.com/osmtile/europe/austria/osmtile_europe_austria_latest_compressed.dump
Dataset download, restore instructions
You can see instructions beside each published dump as readme.txt. For Austria, instructions can be accessed at https://gis.cybertec-postgresql.com/osmtile/europe/austria/readme.txt.
Let’s quickly look at the instructions to better understand how we must proceed. As a requirement, you must prepare the database with the extensions PostGIS
and hstore
enabled.
1 2 3 4 5 6 7 8 9 |
postgres=# create database tilingdb; CREATE DATABASE postgres=# c tilingdb psql (13.3 (Ubuntu 13.3-1.pgdg20.04+1), server 13.4 (Ubuntu 13.4-1.pgdg20.04+1)) You are now connected to database 'tilingdb' as user 'postgres'. tilingdb=# create extension postgis; CREATE EXTENSION tilingdb=# create extension hstore; CREATE EXTENSION |
Finally, the dump can be restored by executing
1 2 |
pg_restore -j 4 --no-owner -d tilingdb osmtile_europe_austria_latest_compressed.dump |
This results in a new database schema osmtile_europe_austria
.
1 2 3 4 5 6 7 |
tilingdb=# dn List of schemas Name | Owner ------------------------+---------- osmtile_europe_austria | postgres public | postgres (2 rows) |
The listing below shows the tables generated within our schema.
1 2 3 4 5 6 7 8 9 10 11 12 |
tilingdb=# dt+ osmtile_europe_austria. List of relations Schema | Name | Type | Owner | Persistence | Size | Description ------------------------+--------------------+-------+----------+-------------+---------+------------- osmtile_europe_austria | planet_osm_line | table | postgres | permanent | 1195 MB | osmtile_europe_austria | planet_osm_nodes | table | postgres | permanent | 3088 MB | osmtile_europe_austria | planet_osm_point | table | postgres | permanent | 323 MB | osmtile_europe_austria | planet_osm_polygon | table | postgres | permanent | 1865 MB | osmtile_europe_austria | planet_osm_rels | table | postgres | permanent | 102 MB | osmtile_europe_austria | planet_osm_roads | table | postgres | permanent | 130 MB | osmtile_europe_austria | planet_osm_ways | table | postgres | permanent | 1996 MB | (7 rows) |
This article briefly introduces CYBERTEC's brand new OpenStreetMap download service. The service has been released recently, and we are very curious what customers think about it. Please leave a message to give us feedback, discuss further dataset import variants, or in case you need assistance. Check out this post if you want to know how to start out with PostgreSQL and PostGIS.
Please leave your comments below. In order to receive regular updates on important changes in PostgreSQL, subscribe to our newsletter, or follow us on Facebook or LinkedIn.
+43 (0) 2622 93022-0
office@cybertec.at
You are currently viewing a placeholder content from Facebook. To access the actual content, click the button below. Please note that doing so will share data with third-party providers.
More InformationYou are currently viewing a placeholder content from X. To access the actual content, click the button below. Please note that doing so will share data with third-party providers.
More Information
Leave a Reply