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

I am attempting to allow users to view a map and use UI components, such as checkboxes, to toggle certain layers of data on or off. Each time a user toggles a layer on, it should send a request to my tile server with the layers that should be visible (LayerX status="on", LayerY status="on").

The default for all of my layers in the Mapnik XML style file is status="off". Is there currently a method of passing these parameters to the renderd service and dynamically changing the XML file before rendering the tiles?

Since each request has the possibility to generate a new version of a tile, I would not like to cache each request. How can I turn off mod_tile's caching abilities to prevent tiles with the wrong data being returned the the client?

From what I have noticed, after every change to the XML file, renderd is required to be restarted. Is it possible to not restart renderd, but modify the XML file to display different layers?

asked 17 Oct '17, 19:30

pantaphobic's gravatar image

pantaphobic
11112
accept rate: 0%

No idea about within Mapnik, but could you perhaps have different layers of tiles turned on and off within Leaflet?

(17 Oct '17, 19:32) SomeoneElse ♦

I am not currently using and am not planning on using leaflet. I am using the google maps API to get the base world map and adding transparent tiles overtop of that rendered by Mapnik.

(17 Oct '17, 20:09) pantaphobic

You'll probably not want to use renderd and mod_tile, but instead something like "LiveTiles" (https://github.com/openstreetmap/mapnik-stylesheets/blob/master/livetiles/livetiles.wsgi - but there are other similar implementations). This never caches tiles. You'll have to add a little code that parses a layer list from the tile URL and switches on the layers before actually rendering the tile but that's only a few lines of code.

permanent link

answered 17 Oct '17, 21:38

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

This looks exactly like what I need, but I am a bit concerned with the following line in their documentation: "render live mapnik tiles on request which is handy for maintenance of mapnik styles and completely unsuitable for a production tileserver." Do you think for my unique use case this should be ignored?

(17 Oct '17, 21:43) pantaphobic

According to open street maps documentation, it looks like this tool was replaced by TileLite. I will look into it further, thank you for the recommendation! http://wiki.openstreetmap.org/wiki/User:Stanton/Mapnik_Test_Server#Live_Rendering_with_LiveTiles_TileLite

(17 Oct '17, 21:49) pantaphobic
2

The whole approach of rendering all tiles on demand is unsuitable for a production server if you are using a style that comes anywhere near the standard style in complexity. However, if your layers are relatively simple and your database small then you can get away with it. The problem with the approach is that not only does it not cache tiles, it also doesn't do meta tiles which leads to a higher load on the database. For your particular use case, TileLite or LiveTiles probably does not make a difference.

(17 Oct '17, 21:59) Frederik Ramm ♦

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
×105
×80

question asked: 17 Oct '17, 19:30

question was seen: 3,466 times

last updated: 17 Oct '17, 21:59

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