i am working on reactjs project, i am using this package google-map-react to show the map. I also here need to show my Map Areas for that i am using one geojson file to show the areas, Now i a have one requirement to check if user clicks outside of geojson coordinates data on the map. How can i implement that. Or if you have any package suggestion where it possible to load geojson file .suggest me. I also tried @react-google-maps/api but i am not here to load geojson file.
import React from "react";
import "./styles.css";
import GoogleMapReact from "google-map-react";
import MedianIncomeKml from "./data/doc1.geojson";
const GOOGLE_API_KEY = MY_KEY
const selection = () => {
console.log("selection");
};
export default function App() {
return (
<div className="App" style={{ width: "100%", height: "100%" }}>
<GoogleMapReact
style={{ width: "100vw", height: "100vh" }}
bootstrapURLKeys={{
key: GOOGLE_API_KEY,
libraries: ["visualization"]
}}
defaultCenter={{
lat: 25.2858687,
lng: 55.3281742
}}
defaultZoom={10}
yesIWantToUseGoogleMapApiInternals
onGoogleApiLoaded={({ map, maps }) => {
map.data.loadGeoJson(MedianIncomeKml);
// const kml = new maps.KmlLayer({
// url: MedianIncomeKml
// });
// kml.setMap(map);
}}
>
</GoogleMapReact>
</div>
);
}