systemed / tilemaker

Make OpenStreetMap vector tiles without the stack
https://tilemaker.org/
Other
1.5k stars 233 forks source link

Process Multipolygon Islands? #497

Closed koufopoulosf closed 1 year ago

koufopoulosf commented 1 year ago

Hi,

I have noticed that some data are stored as Relations in OSM and not as Nodes.

For example, run here: https://overpass-turbo.eu/

This query:

[out:json];
(
  node(39.1189, 23.7174, 39.2047, 23.9451)["place"];
  relation(39.1189, 23.7174, 39.2047, 23.9451)["place"];
);
out center;

You will notice that some places like "island" or "archipelago" etc. are stored as Relations.

Does tilemaker support relations with multipolygon types? (Edit: I have read the documentation)

Is there a way I can add these relations to a layer? or print the relation names on terminal (with type multipolygon)?

I am trying out something like this for process.lua:

function process_islands(relation)
    if relation:Find("type") == "multipolygon" and relation:Find("place") == "island" then
        local name = relation:Find("name")
        print(name)
        relation:Layer("multipolygon_layer", true)
        relation:MinZoom(3)
        relation:Attribute("name", name)
    end
end

function relation_scan_function(relation)
    if relation:Find("type") == "multipolygon" and relation:Find("place") == "island" then
        relation:Accept()
        process_islands(relation)
        print(relation:Find("name"))
    end
end

And also for config.json something like this:

"multipolygon_layer": {
    "minzoom": 3,
    "maxzoom": 14
},

I am running it through this command:

tilemaker --config config.json --process process.lua --input data/greece-latest.osm.pbf --output data/greece.mbtiles

However nothing seems to work. What am I missing?

Thank you very much once again for your support, I highly appreciate it πŸ™

systemed commented 1 year ago

Multipolygons are processed natively with way_function. You don’t need any special handling.

koufopoulosf commented 1 year ago

Hi @systemed, thank you very much!! πŸ™πŸ™πŸ™