1

I'm trying to load the Mapillary vector tiles layer in a Leaflet map.

I'm using Leaflet.MapboxVectorTile (ref. https://github.com/SpatialServer/Leaflet.MapboxVectorTile).

Here you are my code ...

  var map = new L.map('map').setView([44.907852, 7.673789],16);

  L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
    attribution: '? OpenStreetMap contributors'
  }).addTo(map);

  var config = {
    url: "https://d2munx5tg0hw47.cloudfront.net/tiles/{z}/{x}/{y}.mapbox"
  };

  var mapillarySource = new L.TileLayer.MVTSource(config);
  map.addLayer(mapillarySource);

The code is working and I can see the vector tile layer on the map but when I zoom in on my map I can't see the layer after 14 zoom level.

I've tried to use also

minzoom = 0
maxzoom = 16

in the layer configuration but nothing change.

Trying to use the Mapillary viewer, for example

http://www.mapillary.com/map/search/44.90213653940583/7.661219012127532/13

I see that the vector layers at every zoom level.

Using Firebug I see that their code is quite similar to my code .....

      config = {
        url: 'https://d2munx5tg0hw47.cloudfront.net/tiles/{z}/{x}/{y}.mapbox?access_token=pk.eyJ1IjoibWFwaWxsYXJ5IiwiYSI6ImZCRUVhYm8ifQ.MwcTuq2Q0KHcJxC_Whra7w',
        zIndex: 1000,
        style: function(feature) {
          var style;
          style = {};
          style.color = 'rgba(53, 175, 109, 0.5)';
          style.size = 3;
          return style;
        }
      };
      mvtSource = new L.TileLayer.MVTSource(config);
      map = mapCtrl.getMap();
      return map.addLayer(mvtSource);

For test I've tried to change my code using the Mapillary original layer definition above (with and without the access_token ....), but nothing change.

How may I see the Mapillary vector tiles at each zoom level?

Any suggestion, example, jsfiddle?

1

It appears that the tiles are not showing up because they do not exist. If you look at the console output or network traffic log, you will see that 403 (Forbidden) errors are being produced for all tiles above zoom level 14 in this area (in other areas, there is data for zoom levels up to 16) as well as any tile that does not contain data.

Even on the Mapillary site, if you pan around at high zoom levels (>14), some tiles may "disappear" and will not reappear until you zoom out to 14 again. So it looks like they are using cached vector tiles from lower zoom levels if no tiles are available for the current zoom level.

There is an open issue on the GitHub page for the Leaflet.MapboxVectorTile plugin that might address this problem (by forcing use of tiles from lower zoom levels), but it has been open for almost a year, so it may not be implemented any time soon.

  • Yes, I've seen those "403 Forbidden" errors but I thought it was about those tiles with no data inside. I'm not so sure that they use cached vector tiles from lower zoom levels if no tiles are available for the current zoom level, lines in the map are well defined. I'll try to ask in the Mapillary forum for info if I get good feedback I'll report here. – Cesare Apr 22 '16 at 6:50

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.