Mapbox display tile borders on polygon styled as line

665 views Asked by At

I am trying to display the borders of polygon with some line attributes based on zoom. The only problem is that on certain zoom levels the borders of tiles are shown.

Polygono a zoom alejado

Polygono con zoom cercano

The style that I am using to display this is :

{ type: 'line',
'source-layer': 'pluto15v1',
"layout": {
  "line-round-limit": 1,
  "line-cap": "round",
  "line-miter-limit": 0,
  "line-join": "round"
},
"paint": {
    "line-color": [
        "step",
        ["zoom"],
        "hsla(0, 86%, 56%, 0)",
        7,
        "hsla(0, 86%, 56%, 0.58)",
        13,
        "hsl(0, 86%, 56%)",
        22,
        "hsla(0, 86%, 56%, 0.29)"
    ],
    "line-width": [
        "interpolate",
        ["linear"],
        ["zoom"],
        9,
        13,
        16,
        22,
        22,
        22
    ],
    "line-opacity": 0.76
}
1

There are 1 answers

0
Steve Bennett On

Your problem is that your feature geometries are Polygon. When they are cut at tile boundaries, you end up with polygons that have an edge along the tile boundary.

If you use feature geometries that are LineString instead, then this doesn't happen. At tile boundaries, they are clipped and there is no part along the tile boundary.