How to remove GMSPolygon from GMSMapView

When you create the GMSPolygon you set its map property to add it to the map. To remove it from the map, set its map property to nil. This means you need to keep your own record of the polygons which you've added to the map, which you want to be able to remove later.

For example mySavedPolygon.map = nil


This has been updated, has I am using the clear function, and was looking for a way to keep the polygons while using this.

I've just confirmed against the Google Maps API Reference.

Clears all markup that has been added to the map, including markers, polylines and ground overlays.

https://developers.google.com/maps/documentation/ios-sdk/reference/interface_g_m_s_map_view.html#a28e6b8aeb7c8dc9025dc001f2a5d2c9b


From google maps document

  • clear Clears all markup that has been added to the map, including markers, polylines and ground overlays.

So you just use

[mapView clear];

This should clear the polygons.