Skip to content

Commit

Permalink
Treat 404'd tiles as renderable empty tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhamley committed Jun 12, 2018
1 parent a3aaa76 commit a9c4ba2
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 7 deletions.
65 changes: 60 additions & 5 deletions debug/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,69 @@
<script src='/debug/access_token_generated.js'></script>
<script>

var map = window.map = new mapboxgl.Map({
// var map = window.map = new mapboxgl.Map({
// container: 'map',
// zoom: 12.5,
// center: [-77.01866, 38.888],
// style: 'mapbox://styles/mapbox/streets-v10',
// hash: true
// });

mapboxgl.accessToken = 'pk.eyJ1IjoiZ3NkcG0iLCJhIjoiY2lqbmN5eG9mMDBndHVmbTU5Mmg1djF6MiJ9.QqFCD7tcmccysN8GUClW8w';
const style = {
"version": 8,
"light": {
"position": [1.15, 225, 60]
},
"sources": {
"streets": {
"url": 'mapbox://gsdpm.e7248292',
"type": 'vector'
}
},
"layers": [
{
'id': 'PAK_District_Circles',
'type': 'circle',
'source': 'streets',
'source-layer': 'PAK_District_Points',
'layout': {},
'paint': {
'circle-opacity': .5,
'circle-color': "#fdbf6f",
'circle-stroke-width': .75,
'circle-stroke-color': '#555555',
'circle-stroke-opacity': .5,
'circle-blur': .05,
'circle-radius':
{
property: 'P14_DIST',
type: 'exponential',
stops: [[{"zoom": 4,"value": 5}, 1],
[{"zoom": 4,"value": 95}, 9],
[{"zoom": 5,"value": 5}, 2],
[{"zoom": 5,"value": 95}, 18],
[{"zoom": 6,"value": 5}, 4],
[{"zoom": 6,"value": 95}, 36],
[{"zoom": 7,"value": 5}, 8],
[{"zoom": 7,"value": 95}, 72],
[{"zoom": 8,"value": 5}, 16],
[{"zoom": 8,"value": 95}, 144]]
}
}
}
]
};

var map = new mapboxgl.Map({
container: 'map',
zoom: 12.5,
center: [-77.01866, 38.888],
style: 'mapbox://styles/mapbox/streets-v10',
hash: true
style,
minZoom: 4,
zoom: 5,
center: [68.919, 30.081]
});

map.showTileBoundaries = true;
</script>
</body>
</html>
4 changes: 2 additions & 2 deletions src/source/vector_tile_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ class VectorTileSource extends Evented implements Source {
if (tile.aborted)
return callback(null);
if (err) {
if (err && err.status !== 404) {
return callback(err);
}
if (data && data.resourceTiming)
tile.resourceTiming = data.resourceTiming;
if (this.map._refreshExpiredTiles) tile.setExpiryData(data);
if (this.map._refreshExpiredTiles && data) tile.setExpiryData(data);
tile.loadVectorData(data, this.map.painter);
callback(null);
Expand Down

0 comments on commit a9c4ba2

Please sign in to comment.