Hi All,
We are plotting marker over google map w.r.t our locations, also having 
custom location search on google map, once user search any location we are 
opening InfoWindow corresponding to searched location. We are having 
locations with latitude =0 and longitude =0 (these location we can edit 
later on as per requirement). Problem is if we search two or more any 
locations which having latitude =0 and longitude =0, infoWindow are opening 
at same place and overlapping to each-other, I am closing infoWindow each 
time before open new one, not sure why map is not detaching infoWindow from 
marker. Below is my piece of code for custom search, please suggest how can 
I remove the previous opened infoWindow from map on each search.

  public searchLocation(
    point) {
    let markers = [];
    this.gmapsApi.getNativeMap()
      .then((map) => {
        let markerIcon = {
          url: 'Green.png',
          scaledSize: new google.maps.Size(30, 25)
        };

        let marker = new google.maps.Marker({
          position: new google.maps.LatLng(point.latitude, point.longitude),
          icon: markerIcon,
          value: point
        });

        let infoWindow = new google.maps.InfoWindow({
          content: marker.value.locationName,
          position: new google.maps.LatLng(point.latitude, point.longitude),
          pixelOffset: new google.maps.Size(0, -25)
        });
infoWindow.close();
        infoWindow.open(map, marker);
      });
  }

Thanks,
Yogendra Kaushik

 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-maps-js-api-v3+unsubscr...@googlegroups.com.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
Visit this group at https://groups.google.com/group/google-maps-js-api-v3.
For more options, visit https://groups.google.com/d/optout.

Reply via email to