0

I'm very new and very confused about how to accomplish a seemingly simple task: generate my own OSM .png tiles for offline use. Since I want to be able to have a huge amount of tiles, I don't want to load the server by downloading tiles directly from tile.openstreetmap.org.

I was using Creating your own tiles, but learned that this method is outdated with the new styling method: mapnik-stylesheets issue #15

Since this is all new to me, I'm quite confused at the sheer number of methods and tools I've seen recommended to download, format, and render OSM tiles. As far as my progress, here are the steps I have taken:

  1. Created a Postgres database named gis, enabling the postgis and hstore extensions
  2. Downloaded arizona-latest.osm.pbf from https://download.geofabrik.de/north-america.html
  3. Used osm2pgsql to import arizona-latest.osm.pbf into the Postgres database gis: osm2pgsql -G --hstore --style openstreetmap-carto.style --tag-transform-script openstreetmap-carto.lua -d gis --slim --flat-nodes /home/user/nodes.cache --cache 5000 /home/user/downloads/arizona-latest.osm.pbf
  4. Generated shapefiles using scripts/get-shapefiles.py in the openstreetmap-carto directory
  5. Created osm.xml by running carto project.mml > osm.xml
  6. Successfully generated an image using generate_image.py from the outdated mapnik-stylesheets with warnings about failing to understand the new carto xml format.
  7. Failed to generate tiles using generate_tiles.py from the outdated mapnik-stylesheets with the same errors from generate_image.py.

I'm at a loss at where to go from here with my current understanding of how this all works. If anyone can point me in the right direction, I'd greatly appreciate it.

asked 13 Jul '19, 00:23

Karmic%20Creditor's gravatar image

Karmic Creditor
16113
accept rate: 0%


One Answer:
1

What I'd suggest is:

The problem with generate_tiles.py is that it'll complain about unused font definitions in the stylesheet.

Edit: As noted below this will generate metatiles, not .png tiles, which probably isn't the best route here.

permanent link

answered 13 Jul '19, 00:41

SomeoneElse's gravatar image

SomeoneElse ♦
33.0k65343778
accept rate: 16%

edited 13 Jul '19, 11:09

1

I did have to edit the osm.xml to remove all fonts except Deja Vu Sans because of the complaining. The errors/warnings I get when running the scripts are similar to attribute 'maximum-scale-denominator' with value '100000' at line 0, which, if I understand correctly, is because of the new styles used by OSM. I will try your method and report back.

(13 Jul '19, 00:58) Karmic Creditor
1

@SomeoneElse

The method you suggested works great. One thing I'm curious about is the diary entry you mentioned. When calling render_list, it seems to create .meta files. Does this produce .png files somewhere I'm not looking?

(13 Jul '19, 06:01) Karmic Creditor
2

.meta files are containers that contain 64 PNG files each. To extract .png from .meta, either run mod_tile in your Apache web server and run lots and lots of "wget" or "curl" commands against your own web server, or use https://github.com/geofabrik/meta2tile to go from meta to png without mod_tile/Apache.

(13 Jul '19, 10:01) Frederik Ramm ♦
1

It sounds like you're nearly there - just one comment about "I did have to edit the osm.xml to remove all fonts except Deja Vu Sans because of the complaining":

You might find it easier to edit the stylesheet (the thing you run "carto" on) rather than editing the generated .xml directly. If you can find out what's causing the problem you can probably edit it out in one place in a .mss file rather than many from the generated .xml.

(13 Jul '19, 11:15) SomeoneElse ♦

Thank you two for the help. I will use meta2tile when the render_list completes

(13 Jul '19, 12:14) Karmic Creditor

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×585
×322
×243
×19
×17

question asked: 13 Jul '19, 00:23

question was seen: 2,524 times

last updated: 13 Jul '19, 12:14

powered by OSQA