Mapbox-gl-js: Dashed line dashes are clipped & offset at tile boundaries

Created on 3 Oct 2017  ·  2Comments  ·  Source: mapbox/mapbox-gl-js

mapbox-gl-js version: 0.40.1

Steps to Trigger Behavior

  1. Draw line with line-dasharray: [0.1, 1.8] and line-cap: round that crosses tile boundary
mapboxgl.accessToken = 'pk.eyJ1IjoicXVpY2tseXdpbGxpYW0iLCJhIjoibmZ3UkZpayJ9.8gNggPy6H5dpzf4Sph4-sA';
var map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/mapbox/streets-v9',
    center: [ -122.63480377210192, 45.49858719777322],       
    zoom: 20.505
});

map.showTileBoundaries = true;

map.on('load', function () {

    map.addLayer({
        "id": "route",
        "type": "line",
        "source": {
            "type": "geojson",
            "data": {
                "type": "Feature",
                "properties": {},
                "geometry": {
                    "type": "LineString",
                    "coordinates": [[-122.63332018999998, 45.49907065], [-122.63635848, 45.498128739999984]]
                }
            }
        },
        "layout": {
            "line-join": "round",
            "line-cap": "round"
        },
        "paint": {
            "line-color": "#191",
            "line-width": {
            'base': 1.5,
            'stops': [
                [14, 5],
                [18, 20],
            ],
        },
            "line-dasharray": [0.1, 1.8]
        }
    });
});

jsbin: http://jsbin.com/kiqinefopa/edit?html,output

Expected Behavior

Dashes are shown at regular spacing regardless of tile boundary locations; no artifacts are visible at tile boundaries

Actual Behavior

Dash positions appear shift between tiles and are clipped at tile boundaries. The effect varies with zoom level.

image

bug

All 2 comments

This issue will not be fixed in the near future. As dash lines of each tile are rendered independently, shifted dash in the boundaries is unavoidable.

Noticed this on lines too.
image

Was this page helpful?
0 / 5 - 0 ratings