Rendered my first OSM image!
I’ve been playing around with OpenStreetMaps recently. I downloaded a subset of the world data set covering San Francisco by using this tool: http://78.46.81.38/. I loaded the data into a local PostGIS database with osm2pgsql. Then I spent a couple hours installing the prerequisites for Mapnik and building Mapnik itself, which was the hardest part but still very doable. Once Mapnik was installed, I was able to use the generate_image.py script to generate a quick map of SF. Next step is to learn how to build tiles for slippy maps, and then how to customize them.
The process was mostly easy and rewarding. One funny quirk: osm2pgsql can’t do password authentication to the database, so it’s most convenient to use a passwordless account. Mapnik, on the other hand, appears to choke if it is given an empty password string, so you need to add a password to the account once you get to the Mapnik stage.
Mapnik should not have any problem with either an empty password string or leaving the password parameter out (whether from python or XML). More details on what you ran into would be great.
Dane
27 Mar 10 at 2:06 pm
Here’s what I ran:
$ ./generate_xml.py –dbname sfosm –host localhost –user jsha –accept-none
Include files written successfully! Pass the osm.xml file as an argument if you want to serialize a new version or test reading the XML
$ ./generate_image.py
Traceback (most recent call last):
File “./generate_image.py”, line 38, in
mapnik.load_map(m,mapfile)
RuntimeError: PSQL error:
fe_sendauth: no password supplied (encountered during parsing of layer ‘leisure’)
Then I changed the DB user to have a password, and re-ran generate_xml.py:
$ ./generate_xml.py –dbname sfosm –host localhost –password XXXX –user jsha –accept-none
Include files written successfully! Pass the osm.xml file as an argument if you want to serialize a new version or test reading the XML
$ ./generate_image.py
And that succeeded!
While I’ve got your attention, BTW, the render above seems to be missing a bunch of streets near the south end of the city, and in Treasure Island (the big island to the northeast). Do you have any ideas off the top of your head why that might be, and how I could fix it?
jsha
29 Mar 10 at 12:03 pm
To clarify, this is using the OSM-specific Mapnik wrappers described at http://wiki.openstreetmap.org/wiki/Mapnik. And I found the answer to my problem near the bottom of that page: http://wiki.openstreetmap.org/wiki/Mapnik#Troubleshooting. Evidently I had to remove all the authentication information and allow postgres to use ‘ident same user’ authentication.
jsha
29 Mar 10 at 1:26 pm
ya, that’s a postgres config issue only.
dane
15 Apr 10 at 10:55 pm
btw, if you have further questions, post to the mapnik-users list as it’s unlikely I will bump into this post again.
dane
15 Apr 10 at 10:56 pm