summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/networkMapApp/src/utils/mapUtils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/odlux/apps/networkMapApp/src/utils/mapUtils.ts')
-rw-r--r--sdnr/wt/odlux/apps/networkMapApp/src/utils/mapUtils.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/sdnr/wt/odlux/apps/networkMapApp/src/utils/mapUtils.ts b/sdnr/wt/odlux/apps/networkMapApp/src/utils/mapUtils.ts
index 34cdc0638..da3e97ee3 100644
--- a/sdnr/wt/odlux/apps/networkMapApp/src/utils/mapUtils.ts
+++ b/sdnr/wt/odlux/apps/networkMapApp/src/utils/mapUtils.ts
@@ -21,6 +21,17 @@ const EARTHRADIUSM = 6378137;
type updatedCoordinates = { south: number, west: number, north: number, east: number };
+export const increaseBoundingBox = (map: mapboxgl.Map) =>{
+
+ const bbox = map.getBounds();
+
+ const distance = map.getCenter().distanceTo(bbox.getNorthEast()); // radius of visible area (center -> corner) (in meters)
+
+ //calculate new boundingBox
+ const increasedBoundingBox = addDistance(bbox.getSouth(), bbox.getWest(), bbox.getNorth(), bbox.getEast(), (distance / 1000) / 2);
+ return increasedBoundingBox;
+}
+
export const addDistance = (south: number, west: number, north: number, east: number, distanceKm: number): updatedCoordinates => {