3

Using the information in this question, I managed to unpack a random small mbtiles vector tile map from osm2vectortiles.org and load it locally in a browser using npm http-server, based on this OpenLayers example. This leaves me with this question, when I download the world map for zoom level 0-5 from osm2vectortiles.org, I seem strange triangles tiles appearing in the sea at level 2,3,4 and 5. Please see the screenshot. Land looks perfect.

How can I resolve this?

water triangels

1

This appears to be caused by a bug in openlayers

https://github.com/openlayers/openlayers/issues/6341

either get a version of openlayers with that fixed or make sure your water polygon has a stroke when you set it's style. I used this to fix this issue.

function createMyStyle() {
    var strokedPolygon = new ol.style.Style({fill: fill, stroke: stroke});
    var styles = [];
    return function(feature, resolution) {
        var length = 0;
        var layer = feature.get('layer');
        if (layer == 'water') {
            fill.setColor('#a0c8f0');
            stroke.setColor('#a0c8f0');
            stroke.setWidth(1);
            styles[length++] = strokedPolygon;
        } .....all the other styles
        }
        styles.length = length;
        return styles;
   };
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.