Friday 15 May 2015

javascript - Google Maps API check if marker exists in multiple bounds -


I am trying to check whether markers are already present before adding them to maps in my limits . I've found that its best method is using

map.getBounds (). In this (marker. GetPosition ()) which is present on the marker map and if it is false, if it does not happen then because on the wrong, I connect the marker on the map.

This works fine, but I have many limitations and map.getBounds () gets 1 border.

Set the code below in each loop in a loop, but checks that the marker is present in only 1 range. How can I check that markers are present in all my borders?

I am checking markers in the previous function

  function search () {var boundsArray = new array (); // Array of many limitations for me (var i = 0; i & lt; boundsArray.length; i ++) {var boundary = Boundarre [i]; // Search this boundary var request = {border: border, keyword: document.getElementById ("keyword"). Value}; Service. Search (request, callback); }}); } Returns // locations and marker functions create callback (result, status) {if (position == google.maps.places.PlacesServiceStatus.OK) {for (var i = 0; i & lt; results.length; i ++) {createMarker (Results [i]); }} // markers create a markmarker (place) {var marker = new google.maps.marker ({position: place.geometry.location}); Map = map.getBounds at Var This includes (marker.getPosition ()); // If the marker is not on the map, then add it (if map === incorrect) {marker.setMap (map); }}    

You can create 1 polygon of all these LatLngBounds.

Polygons support multiple paths, so all you need to do is create an array that creates an array with the waves which are defined by 4 characters of the waves for each loud longband, and this array has a polygon Apply in path-property.

This polygon can now be used to determine whether a location is located in any of the LatLngBounds.

No comments:

Post a Comment