2

I've set up a PostGIS database and imported my map data. Then I ran

render_list 

to render my tiles. Serving them through mod-tile works just fine. However, the files on my HDD are *.meta files and I would like to obtain *.png files in the standard z/x/y OSM format. How can I prerender my files?

From what I've seen, there's a python script called 'generate_tiles.py' in this repository: https://github.com/openstreetmap/mapnik-stylesheets/blob/master/generate_tiles.py

I'm not entirely sure how to use it though. I also don't fully understand the difference between XML and CartoCSS and how it applies to my use case.

1

I eventually managed to resolve this. My problem came from the fact that I had installed mapnik via pip install mapnik. That installs a very old version of mapnik that doesn't work with the most current version of openstreetmap-carto. I eventually managed to get it to run with the following parameters to main of 'generate_tiles.py':

if __name__ == "__main__":
    home = os.environ['HOME']
    try:
        mapfile = os.environ['MAPNIK_MAP_FILE']
    except KeyError:
        mapfile = home + "/openstreetmap-carto/style.xml"
    try:
        tile_dir = os.environ['MAPNIK_TILE_DIR']
    except KeyError:
        tile_dir = home + "/osm/output/"

    if not tile_dir.endswith('/'):
        tile_dir = tile_dir + '/'

I have detailed the whole process on https://www.akaritech.com/prerendering-map-tiles-in-z-x-y-format/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.