systemed / tilemaker

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

Zoom level simplification #691

Open saevioapps opened 4 months ago

saevioapps commented 4 months ago

I am trying to add detailed roads to lower zoom level (8) but I don't know how to stop the simplification of features which seems to happen regardless of configuration.

Config file:

{
    "layers": {

        "transportation":    { "minzoom": 4,  "maxzoom": 12, "simplify_below": 1, "simplify_level": 0, "simplify_length": 0, "simplify_ratio": 1 }
    },
    "settings": {
        "minzoom": 0,
        "maxzoom": 8,
        "basezoom": 8,
        "include_ids": false,
        "combine_below": 14,
        "name": "Tilemaker to OpenMapTiles schema",
        "version": "3.0",
        "description": "Tile config based on OpenMapTiles schema",
        "compress": "gzip",
        "filemetadata": {
            "tilejson": "2.0.0", 
            "scheme": "xyz", 
            "type": "baselayer", 
            "format": "pbf", 
            "tiles": ["https://example.com/liechtenstein/{z}/{x}/{y}.pbf"]
        }
    }
}

Process file:

node_keys = { "highway","natural","place","waterway" }

-- Assign nodes to a layer, and set attributes, based on OSM tags
function node_function(node)

end

function way_function()
    local highway  = Find("highway")

    -- Roads
    if highway~="" then
        Layer("transportation", false)
        if highway=="unclassified" or highway=="residential" then highway="minor" end
        Attribute("class", highway)
    end

end

The roads look very simplified at zoom 8 even if I configured no simplification. How can i stop the simplification, or add more details to roads at level 8?

Screenshot 2024-02-29 at 07 08 02
systemed commented 4 months ago

Vector tiles have a resolution of (typically) 4096 pixels across, so anything that you output will be snapped to pixel coordinates - you can't take a z8 tile and infinitely scale it up. What you're seeing appears to be consistent with the coordinates being snapped to the pixel grid.

If you apply a little simplification then it'll probably look better, due to the simplification algorithm smoothing out the "jaggies" that are caused by pixel scaling.