For my current map based application, I need to have the following features on Google Map iOS SDK
- User will select a source and a destination.
- User will put a few turning points on the map to reach from source to destination.
- User will also provide a width in meter.
- Now using this turning points and width I need to create a zone as specified in the following hand made sketch.
I tried to create a polygon using GMSMutablePath. User was also able to drag each marker and resize and reposition the zone.
I have also tried to understand Create a hollow polygon but could not find out a way to generate encoded string to use in the following example code.
let hydePark = "tpwmEkd|y[QVe@Pk@BsHe@mGc@iNaAKMaBIYIq@qAMo@Eo@@[Fe@DoALu@HUb@c@XUZS^ELGxOhAd@@ZB`@J^BhFRlBN\\BZ@`AFrATAJAR?rAE\\C~BIpD"
let archibaldFountain = "tlvmEqq|y[NNCXSJQOB[TI"
let reflectionPool = "bewmEwk|y[Dm@zAPEj@{AO"
let polygon = GMSPolygon()
polygon.path = GMSPath(fromEncodedPath: hydePark)
polygon.holes = [GMSPath(fromEncodedPath: archibaldFountain)!, GMSPath(fromEncodedPath: reflectionPool)!]
In my exploration project, user was specifying the location coordinate, which I do not want. Rather user will just put the turning points on the maps and provide the width and the zone will be calculated automatically.
If there is any existing functionality from GoogleMaps SDK to achieve that? Or I need to follow a complex geometric calculation to draw the zone?