Making a basemap with OSM data, some notes


Creating a zoomable map with openstreetmap data that covers the entire world is doable even if you’re a single-person entity without your own server infrastructure. You’ll have to use a provider like AWS to scale up to the level of performance that you’ll need, of course. As with any cartography project, minding the data becomes about 50% of the work and multi-zoom basemaps of the world are certainly no exception to that rule.

blogpostosm

A tool like imposm or osm2pgsql is usually required to parse data from a source like geofabrik (pbf). At Boundless we’ve had some great success with imposm3, though it is still in the experimental phase, but so far proves to be much faster than imposm2. The benefit of imposm is that you don’t dump everything into 3 tables like osm2pgsql; instead you dump it into any number of tables based on data type, usually around 25 tables (you customize the download via a json file with whatever parameters you want to specify). This makes querying faster. You also get “diff support,” which means that you can easily incorporate updates from OSM diff files, thus enabling easy updates however often you want to update. (We haven’t tested that in imposm3 yet.)

Going along with the “data is 50% of the project” maxim, you need to become familiar with PostGIS in order to deal with this data. You need to be able to use a viewer like pgAdmin and/or get familiar with the command-line tools both for viewing the tables and their contents so that you can actually use and style the data but also to manipulate the data if needed.

For example, performance is often enhanced if you create attribute indexes on any attributes that you are using for styling. Let’s say I’m showing parks at a high zoom level. My GeoServer SLD that contains the styling rules for my map might specify that type=parks in table landusages needs to be green with a dark green outline. The table landusages may benefit from an attribute index being created on the type field.

blogpostosm3

Personally, I believe the very best way to get familiar with all the tools that I’ve mentioned above is to play with them yourself in a real-world environment. For this my favorite two options are 1) learn on your own (I love Boundless’s new online training courses) and 2) attending a maptime near you. And on a final note, don’t try to download and parse the entire world’s worth of OSM data your first time. 😉 Start with a city, county, or small state of interest and scale up from there.

Spending even a few nights beginning to fool around with OpenStreetMap, imposm2 or imposm3, PostGIS, and/or GeoServer will make you more marketable. Investing in this knowledge acquisition will certainly pay dividends.

Comments are closed.