NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Is there a way to force mapnik not to generate empty tiles? And create instead a symbolic link for that???

Update

Sorry for DUMM question. So how to do that generate_tiles.py will not save empty tiles?

This question is marked "community wiki".

asked 06 Nov '11, 07:54

Gevork's gravatar image

Gevork
234121422
accept rate: 0%

wikified 23 Nov '11, 12:49


I don't have a direct answer, but in practice I add a command at the end of the generation for removing these empty tiles: find tiles/ -size 116c | xargs rm

permanent link

answered 06 Nov '11, 21:48

NicolasDumoulin's gravatar image

NicolasDumoulin
3.3k42256
accept rate: 13%

@NicolasDumoulin do you add this line in the end of generate_tiles.py ????

(06 Nov '11, 22:13) Gevork

Well, no, it is a bash command (linux). But I think you can achieve the same in pure python as follow:

import os,glob;

for f in glob.glob('tiles/**/*'): if (os.path.getsize(f) == 0): os.remove(f)

(07 Nov '11, 08:15) NicolasDumoulin

@NicolasDumoulin when I make find tiles/ -size 116c | xargs rm I get rm: missing operand

here is the output marmur@marmur-Extensa-5635ZG:~/tiles$ find yerevanMap/ -size 116c | xargs rm rm: missing operand Try `rm --help' for more information. marmur@marmur-Extensa-5635ZG:~/tiles$

Any idea why???

(23 Nov '11, 18:45) Gevork

I think it is because the result of the command find is empty, you can check it by removing "| xargs rm" from the command. Maybe the size value isn't correct. I've found the "116" by looking at the printed size of my empty tiles with the "ls -l" command.

(23 Nov '11, 20:09) NicolasDumoulin

@NicolasDumoulin -rw-rw-r-- 1 marmur marmur 139 2011-11-23 00:51 0.png I get this... so should it be -size 139c???

(23 Nov '11, 22:41) Gevork

@NicolasDumoulin thanks! it worked, found out that empty tiles was not 139 but 103 by me.... deleted like a charm! once again, thank you very much

(23 Nov '11, 22:57) Gevork

be aware that empty sea tile, empty land tile, or any other "empty" tile that has only one color in it, may all have exactly the same size.

(09 Jul '14, 22:45) leding
showing 5 of 7 show 2 more comments

I don't think that "only sea tiles are really empty" - in some cases it depends of network connection when Mapnik receives "empty" blue tiles.

permanent link

answered 07 Jun '13, 13:41

nedol's gravatar image

nedol
1
accept rate: 0%

Mapnik doesn't generate tiles; Mapnik is a library only. It is the program that calls Mapnik - e.g. generate_tiles.py or renderd or tirex or something else - that generates tiles, or maybe metatiles. Mapnik has no way of signalling to these calling programs that it has just generated an "empty" tile (anyway, in our standard OSM style, only sea tiles are really "empty", everything else has at least a land polygon drawn).

Read the thread Not saving empty Mapnik tiles on the osm-dev mailing list for more information.

permanent link

answered 06 Nov '11, 10:06

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

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:

×341
×287

question asked: 06 Nov '11, 07:54

question was seen: 9,269 times

last updated: 09 Jul '14, 22:45

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum