I am working on an iOS app whose functionality is to show google map with user current location. I successfully shown user location on map, now I need to draw a route as user moves from current location to another and then to next. Finally at the end on a button click I have to connect very fist location to last location. At the end I need to calculate the drown area in acres.
So I summarize my questions as follows :
How to draw user movement on map?
How to direct connect first and last location on a button click?
How to calculate user moved area?
If I want to draw route from last point to current point on manual click, how to do that?
Please provide any suitable code as well. I would appreciate your efforts.
Related
I have followed the sample example to implement navigation feature in my app. In the app, the user is navigated to two locations: pickup and delivery. Following is the screenshot of the map.
The Mapbox SDK provides details of the navigation like distance, time remaining etc (as indicated by red rectangle in the screenshot above). The SDK is considering the overall route and generating these information, by default.
Is there a way to customise these details? Initially, I would like to show the distance and time remaining to the first location. And with the arrival of the user to the first location, I would like to update the information with that of the next route. Is this doable?
I'm working on an iOS App which draws the path on a map using Polyline options, between source to destination.
This works fine.
What I need is, if the user starts from source, and instead of taking drawn route towards the destination, the user takes another route, the path on the map should be redrawn for user's current path.
I'm using Directions API for drawing the path.
How can I do that?
Thanks in advance.
Yes, you can do that by detecting the change in location. Use didUpdateLocations method of CLLocationManagerDelegate Protocol to detect the change of location. If user location is changed significant then check that if user is still on route or not by using GMSGeometryContainsLocation function.
I am writing an app where a user can select a location and then it will display the directions to it on the map. This functionality works fine, however I need the route to update on the map as the user moves. Currently I am using the didupdatelocations method and creating a new direction line from the new user location, however this results in the polyline being completely redrawn. I am trying to find a way to update the directions as the user moves similar to how apple maps/google maps does this. I do not want to use the navigation window if possible.
I am using the Apple mapKit.
i have looked for similar problems this one with google maps but there have been no replies.
I have seen another example (sorry cannot find link again) which makes an array of all the coordinates in the polyline although im not sure where i would use this or how to use this to slice or remove the unwanted part of the polyline.
At the moment my code does remove all overlays when a new direction is called, but if the overlays are not removed then I will end up with loads of lines on the map. I have tested removing the first polyline after the second polyline is created but that doesn't seem a very efficient way of dealing with this.
would appreciate any suggestions.
After creating a Map View in the storyboard, the default location on the simulator shows up as the United States. Looking from other SO posts, there seems not to be a way to replicate this image since we are not given the default span or region (or any way to access the user's current country and get the corresponding region and span data).
The default map view for the US looks like this:
Is there a way to copy or duplicate the initial state of the map view, so that we can restore it later?
I currently have a "reset" button, but I'm not sure what to reset to. Perhaps make the default region/span the user's current location, if there are no better solutions?
In my iOS app i am displaying many, big annotations, and i set user location to be shown as well. My problem is, that my markers are so big, they are covering user's position, so it's hidden very often.
My question is - is there any "normal" way to set user location's marker above all the annotations, or i have to display custom annotation for user's position, or else?