2016-05-17 21 views
0

我使用谷歌地圖API來繪製多邊形到我的iOS應用程序的地圖裏面,我實現了這個免費的手從這個鏈接畫多邊形: https://github.com/saru2020/SARMapDrawView 所以現在我有一個GMSPolygon,但我想要得到位於多邊形內的GMSMarker。 如果我們想要得到屏幕上的標記,我們這樣做:Google Maps for iOS - How can you tell if a marker is within the bounds of the screen? 所以我想知道是否有任何方法只獲得多邊形內的標記。如何獲得GMSMarker這是GMSPolygon

+0

入住這http://stackoverflow.com/questions/36031919/how-to-calculate-number-of-markers-inside-a-polygon-in-google-maps –

+0

感謝您的答覆。是的,這種方式可以完成,但我想如果谷歌地圖API的ios有任何方法,使多邊形內的標記。 –

回答

1

我知道這是舊的,但我使用它。

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