Google Map Kit, draw polylines for walk like google map ios

I wants to draw polyline for walk like google map app in ios using google maps ios sdk. For more clear understanding i am uploading image that is from google map app(ios.)<img src="https://i.stack.imgur.com/npzVt.png" alt="enter image description here">

Answer1:

Are you asking how to achieve the dotted polyline effect? If so, I don't believe that is supported in the SDK.

You can manually create a similar effect with GMSCircles.

for(int x = 0; x < [self.path count]; x++) { CLLocationCoordinate2D coord = [self.path coordinateAtIndex:x]; //draw circle coord GMSCircle *circle = [GMSCircle circleWithPosition:coord radius:20]; circle.fillColor = [UIColor blueColor]; circle.strokeColor = [UIColor blackColor]; circle.strokeWidth = 2; circle.map = mapView; }

For this to really look like the original example you will probably need to add additional points onto the line in order for the circles to be evenly spaced out. For that you could do something like this.

for(all the points in the path) { if(the distance from pointA to pointB is > some distance) { centerPtr = center point of pointA and pointB insert centerPt in path } }

You can turn this into a simple recursive function that should give you something similar to what you are looking for.

人吐槽 人点赞

Recommend

Comment

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:Google Map Kit, draw polylines for walk like google map ios