Search code examples
iosgoogle-maps-sdk-ios

Google Maps iOS SDK Polygons with holes


I've been playing with the Google Maps SDK for a few days, seems pretty solid, and easy to use. But I'm having problems trying to draw Polygons with holes inside. Currently if I try to add holes to a path (using a naive, "just add the points there" way) I get some holes in the polygons, but it looks totally messed up (even if the holes are counterclockwise, and the main polygon is clockwise). Anybody know what to do to get this rendered correctly?

I know that in Android there's a method called addHole() that solves this. Is there any similar solution for iOS?

I'm using Google Maps SDK version 1.3.1 (latest available at this time).

Thank you very much for your time!


Solution

  • Edit: Google implemented this feature on Version 1.11.0, GMSPolygon now comes with a holes property.

    Seems that right now there's no way to do this, there is an open issue in the google maps api tracker, so let's hope this gets implemented in the near future.