From cbd60dfa10f1b71f1e17803dcfc0fa9b49a7665a Mon Sep 17 00:00:00 2001 From: William Edmisten Date: Mon, 1 Apr 2024 22:53:54 -0400 Subject: [PATCH] Zoom to bounds on map projects --- .../project/north-america-hospital-distance/index.tsx | 11 +++++++++++ pages/project/virginia-hospital-distance/index.tsx | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/pages/project/north-america-hospital-distance/index.tsx b/pages/project/north-america-hospital-distance/index.tsx index 1027fc12..77761254 100644 --- a/pages/project/north-america-hospital-distance/index.tsx +++ b/pages/project/north-america-hospital-distance/index.tsx @@ -71,6 +71,17 @@ const Map = () => { if (error) throw error; map.current?.addImage('hospitalMarker', image); }) + + map.current.fitBounds([ + [ + -127.66160226468281, + 15.666577841851748 + ], // southwestern corner of the bounds + [ + -61.00992217769965, + 52.83448773865328 + ], // northeastern corner of the bounds + ]); }); return ( diff --git a/pages/project/virginia-hospital-distance/index.tsx b/pages/project/virginia-hospital-distance/index.tsx index 0a6ed5cd..6225fcce 100644 --- a/pages/project/virginia-hospital-distance/index.tsx +++ b/pages/project/virginia-hospital-distance/index.tsx @@ -73,6 +73,17 @@ const Map = () => { if (error) throw error; map.current?.addImage('hospitalMarker', image); }) + + map.current.fitBounds([ + [ + -83.79043169282795, + 36.53531313954011 + ], // southwestern corner of the bounds + [ + -74.96413368319128, + 39.511129595313434 + ], // northeastern corner of the bounds + ]); }); return (