1

I currently have a map loaded with my custom geojson. The geojson layer is attached with a z-index of 1 and an onclick function that reads the feature from the geojson data. Since the z-index is higher than the map, the onclick function attached to the layer works perfectly.

Now I want to add an extra functionality that user can input an address that my app will navigate and load the data from the geojson.

However, I tried

      google.maps.event.trigger( mapRef.current, 'click', {
        latLng: address.coordinate
      });

This triggers the onclick function on the map itself but not the geojson layer. Hence the custom features are not fetched. Is there a way to simulate the click on the geojson layer?

ILoveET
  • 109
  • 1
  • 6

0 Answers0