Hi there, I am following tutorials to learn about OSM and how to make some maps. Currently I am using this one, https://github.com/mapnik/mapnik/wiki/GettingStartedInPython but in the instructions it uses shapefiles as a datasource just in a normal file directory. I don’t want to do that, I want the file source to be from my database in PostGIS, where I have stored my OSM data. What do I need to do to make it do that? I tried: lyr = Layer('Geometry from PostGIS') lyr.datasource = PostGIS(host='localhost',user='postgres',password='',dbname='your_postgis_database',table='your_table') which I copied off one of the wiki pages. Obviously I amended details as appropriate, but it just said layer not recognised. I wondered if there way something I had to do or tell it to do to get into the database? In the literature I have read, it says that using PostGIS is one of the most common ways of doing what I want to do, but I cannot seem to find any code to use! Thanks in Advance, Tracey
This question is marked "community wiki".
asked 20 Feb '12, 13:09 lgxtlm |
Please, give us more of your code. Here is one of my script that was working with mapnik two years ago:
answered 27 Feb '12, 10:47 NicolasDumoulin |
An important choice you're also faced with initially is... Do you want to get the default OpenStreetMap stylesheets working with Mapnik? We have a lot of documentation about how to do this. Unfortunately it's a little more fiddly than some of the basic "Getting started" Mapnik tutorials, and you are more restricted as to which Mapnik version you work with and what your data source types are. To get the OSM default stylesheet running you must work with PostGIS (as well as some shapefiles for zoomed out world boundaries and coastline), and you must populate the database using osm2pgsql which is also governed by a matching style configuration file. Hopefully a good guide to all this is the Mapnik wiki page. Having done the database loading, there's some python scripts provided: ...but maybe there's a better half-way-house tutorial involving osm2pgsql and building style rules in python. (Anyone know?) answered 27 Feb '12, 15:59 Harry Wood |
Do you have solve your problem?