0

I am using google maps api to draw a polygon into the map in my ios app, I achieved this free hand drawing polygon from this link : https://github.com/saru2020/SARMapDrawView So now i have a GMSPolygon but i want get the GMSMarker which lies inside the polygon. If we want to get the markers which are in the screen we do it like this way: Google Maps for iOS - How can you tell if a marker is within the bounds of the screen? so i was wondering if there is any way to get only the marker which are inside the polygon.

Community
  • 1
  • 1
Uzair Dhada
  • 333
  • 2
  • 6
  • 23
  • Check this http://stackoverflow.com/questions/36031919/how-to-calculate-number-of-markers-inside-a-polygon-in-google-maps – Android Enthusiast May 18 '16 at 12:07
  • Thanks for the reply. Yeah this way can be done, but i was thinking if google map api for ios has any method which gives markers which are inside the polygon. – Uzair Dhada May 18 '16 at 14:26

1 Answers1

3

I know this is old but I use this.

if GMSGeometryContainsLocation(marker.position, polygonPath, true){
   //marker is within the polygon based on the polygon.path 
}
felixdkatt
  • 53
  • 5