osmfj / tileman

Renamed from tilecache to "tileman": please re-config your git repository. This is OpenStreetMap "Tile-cache" and "Tile-server" recipe with Nginx and embeded Lua. A backend is Tirex, mapnik and PostGIS.
http://osm.jp/
61 stars 16 forks source link

Nginx conf file: Serving multiple overlay tiles #41

Open ghost opened 10 years ago

ghost commented 10 years ago

Hey Hiroshi,

I would like to serve multiple overlays, e.g.

http://localhost/example/13/4093/2724.png --> serving the base layer tile (already working)

http://localhost/overlay/13/4093/2724.png --> serving the overlay layer tile (how would I add that to the nginx configuration?)

So I think the URI has to be parsed dynamically, i.e. if URI contains '/overlay/' set local map = "overlay". Could you give any samples how to adjust nginx conf files accordingly?

My nginx configuration looks like this so far ... location @tileserver { content_by_lua ' -- required module local osm_tile = require "osm.tile" local tirex = require "osm.tirex" local map = "example" <---- base layer is hard coded here local x, y, z = osm_tile.get_cordination(ngx.var.uri, "", "png") -- ask tirex to render it local priority = 1 local ok = tirex.request(map, x, y, z, z, priority) if not ok then return ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) end local tilefile = osm_tile.xyz_to_metatile_filename(x, y, z) local tilepath = "/var/lib/tirex/tiles/"..map.."/"..tilefile local png, err = osm_tile.get_tile(tilepath, x, y, z) if png then ngx.header.content_type = "image/png" ngx.print(png) return ngx.OK end return ngx.exit(ngx.HTTP_NOT_FOUND) '; ...

Thanks for your kind help! Cheers Peter

miurahr commented 10 years ago

I've started working. Sorry for waiting...