2

For my current map based application, I need to have the following features on Google Map iOS SDK

  1. User will select a source and a destination.
  2. User will put a few turning points on the map to reach from source to destination.
  3. User will also provide a width in meter.
  4. Now using this turning points and width I need to create a zone as specified in the following hand made sketch.

enter image description here

I tried to create a polygon using GMSMutablePath. User was also able to drag each marker and resize and reposition the zone.

enter image description here

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?

Sauvik Dolui
  • 5,520
  • 3
  • 34
  • 44

1 Answers1

1

Well I tried to do that, may be in a complicated way, but the problem was it self a complicated one.

Check this repository.

enter image description here

Sauvik Dolui
  • 5,520
  • 3
  • 34
  • 44