Only add highlight layer when ready
This commit is contained in:
parent
3ab86180e7
commit
0e96f3f02e
@ -50,7 +50,7 @@ function map(){
|
|||||||
maxZoom: 20,
|
maxZoom: 20,
|
||||||
minZoom: 14
|
minZoom: 14
|
||||||
})
|
})
|
||||||
highlight_layer.addTo(map);
|
var highlight_layer_added = false;
|
||||||
|
|
||||||
// Query for building on click
|
// Query for building on click
|
||||||
map.on('click', function(e){
|
map.on('click', function(e){
|
||||||
@ -64,6 +64,9 @@ function map(){
|
|||||||
if (data.geometry_id){
|
if (data.geometry_id){
|
||||||
highlight_layer.setUrl('/tiles/highlight/{z}/{x}/{y}.png?highlight='+data.geometry_id)
|
highlight_layer.setUrl('/tiles/highlight/{z}/{x}/{y}.png?highlight='+data.geometry_id)
|
||||||
}
|
}
|
||||||
|
if (!highlight_layer_added && data.geometry_id){
|
||||||
|
highlight_layer.addTo(map);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user