Skip to content
This repository was archived by the owner on Apr 15, 2022. It is now read-only.
This repository was archived by the owner on Apr 15, 2022. It is now read-only.

Nginx conf file: Serving multiple overlay tiles #41

@ghost

Description

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions