This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How can I send a single tile request to mod_tile from the same machine ?

0

I would like to be able to send single tile requests to mod_tile locally. Ideally, I would like to do this without going through apache since it is a waste of CPU time for my application : the request is coming from the same machine where the tile server is installed and the tiles are used locally.

From what I understood I can communicate with renderd via a UNIX socket. I'm ok with that, there's no real documentation but since I have access to the source code I think I can create a client socket, send the correct message and receive a reply from renderd.

Before I start implementing anything, I would like to ask if this is the correct way to proceed. I'm only interested in requesting a single tile at a time (meta-tiles are not good for me). If I'm communicating with renderd directly, without going through mod_tile, then this would imply that the tiles would always be rendered without profiting from mod_tile's cache, am I right?

Does mod_tile have a way to receive commands from either the command line or via a socket? Are there any tools available that allow to send a single tile request to mod_tile ? If not, how can I request a single tile from my tile server ?

Thank you for your time.

asked 16 Nov '15, 21:53

kgaitanis's gravatar image

kgaitanis
21112
accept rate: 0%

edited 16 Nov '15, 21:56


2 Answers:

2

You should be able to use render_list or at least its code, see: https://switch2osm.org/serving-tiles/building-a-tile-server-from-packages/ bottom of the page.

answered 16 Nov '15, 22:25

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

Thank you for your answer, however render_list generates meta-tiles. I'm interested in single tiles (in .png format). Generating meta-tiles and then extracting a single tile seems a little too long. Isn't there a way to get a single tile?

(17 Nov '15, 09:55) kgaitanis

2

Since mod_tile is an Apache module, it's not surprising that requests to mod_tile have to go via Apache.

Renderd generates metatiles on-disk, and doesn't send any image information in response to any requests - it takes a rendering request, puts the metatile on disk, and tells you that the request is complete. While you can take the metatile and decode it to fetch an image, there is a much easier way - just ask mod_tile for the image.

It's possible to set up renderd to use alternate sized metatiles, but I wouldn't recommend it.

I'm intrigued as to what you're rendering. You say that going via mod_tile is a waste of CPU time, but I would guess the overhead is less than 1% compared to the rendering time. Have you measured it? Perhaps you are optimising something that isn't really a problem?

answered 17 Nov '15, 10:29

Andy%20Allan's gravatar image

Andy Allan
12.5k23128153
accept rate: 28%

That's the correct answer : mod_tile is an apache module. I'm just trying to avoid going through the localhost loop but apparently it is not possible. Thanks

(17 Nov '15, 10:33) kgaitanis

Source code available on GitHub .