Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polygon fill failing beyond zoom 11 #797

Open
guillaumemichel opened this issue Feb 7, 2025 · 0 comments
Open

Polygon fill failing beyond zoom 11 #797

guillaumemichel opened this issue Feb 7, 2025 · 0 comments

Comments

@guillaumemichel
Copy link

guillaumemichel commented Feb 7, 2025

I tried generating a very simple map, only including water bodies (lakes) for switzerland-latest.osm.pbf, and it seems there is an issue when rendering lakes fill at a zoom level >= 11.

The screenshot comes from Lake Lucerne, Switzerland, but I can reproduce this for almost all lakes on the map. I am using tilemaker-server to render the tiles. I have also tried with MapLibre GL JS, which produces the same result, so I suspect the issue comes from the map generation rather than rendering.

Zoom 10
Image

Zoom 11
Image

Zoom 12
Image

Zoom 13
Image

The strange lines seem to come from somewhere close to the tile borders. Could it be possible that the polygon isn't complete (some missing lines in the polygon border)? The problem seems to come from polygon filling, since using the MapLibre line layer type works as expected (see below).

Image

Here is the minimal working configuration to reproduce it. Maybe it is a simple configuration mistake and I am sorry in advance if it is the case.

config.json

{
  "layers": {
    "water": {
      "minzoom": 6,
      "maxzoom": 14,
      "simplify_below": 12,
      "simplify_level": 0.0003,
      "simplify_ratio": 2.0
    }
  },
  "settings": {
    "minzoom": 4,
    "maxzoom": 14,
    "basezoom": 14,
    "include_ids": false,
    "name": "Switzerland Lakes",
    "version": "0.1",
    "description": "Switzerland Lakes",
    "compress": "gzip"
  }
}

process.lua

node_keys = { "natural" }

function node_function(node) end

-- Process ways:
function way_function()
	local natural = Find("natural")
	-- -- Process water polygons (e.g. lakes, seas)
	if natural == "water" then
		-- Skip rivers, only process lakes
		if Find("water") == "river" then
			return
		end
		Layer("water")
		Attribute("class", "lake")
		MinZoom(6)
	end
end

index.html for the MapLibre line screenshot

<!DOCTYPE html>
<html>
<head>
    <title>Switzerland Lakes</title>
    <link href="https://unpkg.com/[email protected]/dist/maplibre-gl.css" rel="stylesheet" />
    <script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js"></script>
    <style>
        #map { position: absolute; top: 0; bottom: 0; width: 100%; }
    </style>
</head>
<body>
    <div id="map"></div>
    <script>
        const style = {
            "version": 8,
            "name": "Water Only",
            "glyphs": "https://orangemug.github.io/font-glyphs/glyphs/{fontstack}/{range}.pbf",
            "sources": {
                "tilemaker-tiles": {
                    "type": "vector",
                    "tiles": ["http://localhost:8000/services/switzerland/tiles/{z}/{x}/{y}.pbf"], // mbtileserver
                    "maxzoom": 14
                }
            },
            "layers": [
                {
                    "id": "water-lakes-outline",
                    "type": "line",
                    "source": "tilemaker-tiles",
                    "source-layer": "water",
                    "filter": ["==", ["get", "class"], "lake"],
                    "paint": {
                        "line-color": "#a0c8f0", // Light blue
                        "line-width": 2
                    }
                },
            ]
        };

        // Initialize the map
        const map = new maplibregl.Map({
            container: 'map',
            style: style,
            center: [8.2275, 46.8182], // Switzerland
            zoom: 8,
        });
    </script>
</body>
</html>

I have built tilemaker from the latest commit, and am running arch linux 6.13.1-arch1-1 (btw).

edit: I just updated to the latest available boost version (boost-1.87.0-2-x86_64) and the issue persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant