systemed / tilemaker

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

Tilemaker does not support maritime boundaries #705

Open jtafarrelly opened 2 months ago

jtafarrelly commented 2 months ago

I've been trying for a day or so to get the rendering of worldwide coastal boundaries. See the following for Tileserver-GL rendering of the underlying basemap

image

For the exact same style file in Maputnik, you can immediately see the additional admin_level 2 maritime boundaries, as well as some others:

image

This is most noticeable for coastal waters, but also impacts, for example, nature reserves and marine protected zones (which fall under 'parks' in the OpenMapTiles schema; neither will render). The admin level 2 boundaries should by default include territorial waters - and it should be up to the style sheet to turn them off. Taking a look in the process-openmaptiles.lua file, it appears that this is the cause:

if isBoundary and not (Find("maritime")=="yes") then
        local mz = 0
        if     admin_level>=3 and admin_level<5 then mz=4
        elseif admin_level>=5 and admin_level<7 then mz=8
        elseif admin_level==7 then mz=10
        elseif admin_level>=8 then mz=12
        end

        Layer("boundary",false)
        AttributeNumeric("admin_level", admin_level)
        MinZoom(mz)
        -- disputed status (0 or 1). some styles need to have the 0 to show it.
        local disputed = Find("disputed")
        if disputed=="yes" then
            AttributeNumeric("disputed", 1)
        else
            AttributeNumeric("disputed", 0)
        end
    end

Is there any particular reason why not (Find("maritime")=="yes") is set?

systemed commented 2 months ago

I'll be completely honest and say the particular reason is that I think they look terrible! osm-carto, and styles influenced by it, are the only mainstream maps to show all maritime boundaries. Other webmaps and standard print cartography don't.

That said, if they're in the standard OMT schema, I wouldn't be opposed to a PR to include them in the vector tiles as long as it included a corresponding change to the default stylesheet to not show them.

jtafarrelly commented 2 months ago

Should be simple enough to implement, so I'll take a look this evening. The other maritime features already present in the OMT schema (See here) mentioned above would be fixed by adding boundary=protected_area and boundary=nature_reserve to

    if     boundary=="national_park" then Layer("park",true); Attribute("class",boundary); SetNameAttributes()

There's definitely room for the OMT schema for much more maritime information, I think - from my own research it seems like progress in porting OpenSeaMap data died in the cradle with the move from MapBox to OpenMapTiles. I've been considering writing something like a process-maritime.lua script that would handle seamark information present in the osm.pbf file, but it would also involve sorting the stylesheets - not a trivial endeavour. Possibly a conversation for a different repo though!