Drawing Polyline on an ios Mapview - ios

In my Xamarin ios app I have to draw the path as user walks,
I am planning to do this by drawing Polyline to a Map view by fetching Lattitude & Longitude from CClocationManager, But I have to deal with N number of Lattitude & Longitude in this case,
Is there any simple approach to do this? In our scenario We won't be knowing the destination , User will Just start a run from a point and we have to track his path on map by drawing a line, How could I do this?

A possible solution could be to save the current last known position, which also represents you endpoint of a polyline. On a location change use it as a starting point for the next polyline. That way you draw the route with multiple polylines piece by piece.

Related

How to determine given coordinates are overlaps on polyline route google maps iOS?

I need to find a path between 2 locations. I have a polyline on google map and after give another 2 location points(draw a polyline), is it possible to know the new polyline is overlaps the previous polyline. Or is there a way to determine those new coordinates are on previous polyline. I've googled many times and there is no solution found. Thanks in advance.

Place pin randomly on road - iOS Maps Swift

I'm trying to figure out how I can place an annotation randomly on a road.
I can randomly position an annotation onto a map, but I would like this annotation to be on a road and not in a shopping mall/building/home etc.
Does anyone know the best way I can do this?
One strategy would be to take your random coordinate and then reverse geocode it. That will provide an address closest to your random coordinate. Once reverse geocoded, you can use the result of that process to create your annotation.

Drawing polyline in realtime

I'm fairly new to ios and I would like to know what would be the best approach to draw polyline on google map while user is on the move. So it would only show the path the user has traveled. I'm thinking about using current location as the destination and redraw the polyline as user moves.
EDIT : I'm not even sure if google map is the way to go for this particular scenario since this app is free and there will be fee for API call over 2500 times/day. Is it better to go with Apple Map?
Following these guidelines:
You need to create a GMSMutablePath and add the current user location. As the user moves you add more coordinates to the GMSMutablePath.
When you need to draw the line just instantiate a new GMSPolyline object and set the map property of the GMSPolyline removing the previously drawn polyline setting it's map property to nil.

Identify when MKRoutestep finishes

I am trying to implement a turn by turn navigation system in iOS using MKDirections API. I am able to get the directions of the route and can draw the polyline on the map, and when navigation starts the app start showing the instructions using the MKRouteStep object in Steps array. Now the problem is, since the distance in the MKRouteStep object is the distance that the user covers while traversing the path of the step I am unable to identify how to calculate this distance. Is there any way to calculate this distance ? Currently I am calculating the distance between two coordinates i.e the coordinate when last instruction was shown with the current location of user and if this distance is equal to the distance mentioned in MKRouteStep I am showing the next instruction, due to which it is delaying the instruction to be delivered to user.
If there is any way to identify the coordinate or region where this MKRouteStep ends I can calculate whether the user is in that region or not and then show the next instruction. May be this can work what are your thoughts, but for this how will I know the coordinate or region where this MKRouteStep ends from polyline array of MKRouteStep?
Please suggest if there is any other good solution for this. Any help is highly appreciated.
Thanks.
Since no one has answered to my question I am answering it myself so that it may help someone looking for the same.
So instead of using distance value of MKRouteStep to calculate when to show next instruction, we can use the last coordinate of polyline array provided by MKRouteStep. For example:
MKMapPoint mapPointForEndOfRouteStep = routeStep.polyline[routeStep.polyline.pointCount - 1];
Now you can create a region around it and check whether your current location lies in this region or not.

Draw path in MKMapView using Google Map

I implement MKMapView in my application to draw a path between two place,i found all lat long between two point using google map API but it shows the path through road.
My problem is that i want to show the path in building,
For example:
I want to draw path between the gate1 to gate 2 of Building, i pass the "to and from" lat-long in to the google MAP API, it shows the path through road so it shows the wrong distance.
I tried the indoor map also but it works only in register buildings.

Resources