Skip to content

Commit

Permalink
Change to draw bbox if tiling fails
Browse files Browse the repository at this point in the history
  • Loading branch information
bo-lu committed Nov 19, 2024
1 parent 57065ef commit ae985d4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/components/search/geosearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ const GeoSearch = (

if (result) {
const coordinates=JSON.parse(result.coordinates);
const data = {
const geojson_data = {
type: 'Feature',
properties: { id: result.id, tag: 'geoViewGeoJSON' },
geometry: {
Expand Down Expand Up @@ -267,7 +267,7 @@ const GeoSearch = (

// Draw the bounding box
setTimeout(() => {
new L.geoJSON(data).addTo(map);
new L.geoJSON(geojson_data).addTo(map);
}, 200);
} else if (
imageUrls.length > 0 &&
Expand Down Expand Up @@ -312,29 +312,33 @@ const GeoSearch = (
{ bounds: imageBounds, zIndex: 9999 }
);
//Add tile to map
console.log("Adding tile to map");
//console.log("Adding tile to map");
map.addLayer(layer);
map.setView(new LatLng(tileCenter[1], tileCenter[0]), tileCenter[2]);
setTimeout(() => {
new L.geoJSON(data).addTo(map);
new L.geoJSON(geojson_data).addTo(map);
}, 200);
})
.catch((err) => {
//Handle errors in getting the Tile
console.error("TileJSON Error:", err);
setMapView(center, bounds);
setTimeout(() => {
new L.geoJSON(geojson_data).addTo(map);
}, 200);
});
} else {
// Handle fallback GEO.ca record or default case
setMapView(center, bounds);
setTimeout(() => {
new L.geoJSON(data).addTo(map);
new L.geoJSON(geojson_data).addTo(map);
}, 200);
}
} else {
// Default handling when no options are provided
setMapView(center, bounds);
setTimeout(() => {
new L.geoJSON(data).addTo(map);
new L.geoJSON(geojson_data).addTo(map);
}, 200);
}
}
Expand Down

0 comments on commit ae985d4

Please sign in to comment.