Make a planet file

example map section
If you are reading these articles in the order that they are published, then there are several steps missing between Make your first Map and this one. Sorry. I'll fill in the rest soon. This appears not yet to be documented elsewhere. So it is probably worth jumping ahead for this one.

This article deals with OpenStreetMap API v0.5

Background

Suppose you are running your own OSM API to test things that aren't yet ready for the real world. Perhaps you are experimenting with tagging and rendering and don't want to break the real world while you play. And perhaps you want to check everything from data acquisition to upload, to edit to rendering and see how it all fits together. Eventually you'll want to do that rendering from your local API.

That might or might not be the situation I'm in.

Presume that you already have a working local API. I'll write that up here shortly.

Prerequisites

sudo apt-get install libpqxx-dev

Build tools

One way to render tiles from our local API is to leverage our existing Mapnik stack. That Mapnik stack starts with a planet file, so all we have to do is create a planet file from our local API. I wasn't able to find this documented elsewhere. Shaun Macdonald from #osm pointed me in the right direction. planet05.c will create a planet file from the local API.

Build planet05.c
cd ~/svn.openstreetmap.org/applications/utils/planet.osm/C
make
ls -ctr

The make should complete quickly without errors. You'll have three new programs, UTF8Sanitizer, planet05 and planet06 as shown here.

UTF8sanitizer.exe  planet06.c  Makefile   keyvals.c      planet06
UTF8sanitizer.c    planet05.c  keyvals.h  UTF8Sanitizer  planet05

That build couldn't have been much easier.

Create planet file

This step is pretty simple too. It just worked for me. I used defaults for all of the prerequisites. Your mileage may vary.

Create the planet file from the local OpenStreetMap API.
./planet05 > ~/local-planet.osm
That finished quickly and silently.

How about for API v0.6 with postgres?

With postgres on the new API v0.6 generate your planet file with this.
export CONNECTION_PARAMS="dbname=openstreetmap user=openstreetmap port=5432 host=localhost password='openstreetmap'"
./planet06_pg ~/local-planet.osm

Render tiles with Mapnik

With a shiny new local planet file we are ready to render as found in the previous article, Make your first Map.

Credits and References

Thanks To Shaun Macdonald for pointing me to the right place in svn.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <q> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <h1> <h2> <h3> <h4> <pre> <sup> <sub> <blockquote>
  • Lines and paragraphs break automatically.

More information about formatting options