Free drawing on Maps - ios

I need to create functionality where a user draws (freely) his daily route on a map. Using iOS Maps / Google Maps SDK, how can I achieve it? The MapView will be fixed at a location and a zoom level, so it doesn't move while the user is drawing. The user has to draw a route along the roads shown on the screen. How can I achieve this ?
This is implemented in this app

"There is no way to do that with MapKit: it's easy enough to draw lines when you know the coordinates, but MapKit won't give you access to the roads or other routing information. I'd say you need to call an external API to get your data"
Reference article: Drawing a route in MapKit in iPhone SDK

Related

About Drawing Maps In CarpPlay

I want to draw directions to a specific location in CarPlay. I realized that there are two different options that can be made regarding this. First of all, drawing a direct route from current location to the desired location. The second is to draw the route after showing our current location and selecting the location which we want to go on the map.
Which would make more sense for me to do?
Which authorization is appropriate for the situations I have mentioned?
com.developer.apple.carplay-parking or com.developer.apple.carplay-maps?
Parking or Map?
If you are developing a CarPlay application I would appreciate it if you would also write about the resources you used on the subject.

Draw polylines which follow the roads gemoetry

In my app I want to highlight certain roads, which can easily be achieved just by drawing polylines on top of the roads. (I am using the Google Maps SDK, by the way). However these polylines won't follow the road's geometry, they will just connect two coordinates with a straight line. (I have a coordinate for the start of the road which I want to highlight and the end of it). The coordinates won't change, the same roads will be highlighted through out the whole time in the app.
The question is: Is there a way I could draw these polylines not to be straight but to follow the road's geometry? If it's not possible in the SDK, is there a tool on the internet which will connect two coordinates following the roads between them? Because if there is, than I could get the coordinates of those poylines and parse them in my app.
Cheers!
as #Fabian has suggested, if you have a small set of polylines to show in your app, and your app works mostly offline, it would be better to get all the polylines during the development. And there are two ways:
1) through the direction API, you might able to skip all the implementation by using the WEB API, which is meant for webserver.
https://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&avoid=highways&mode=bicycling&key=API_KEY
2) or, with the Snap to Road API, which might gives you a better control over your route compare to the direction API. This API is meant to fix the pool GPS data you get from the sensor and snap those on the road.

iOS Google Maps: Draw images along a polyline?

Using the Google Maps SDK for iOS (latest version), I'm trying to figure out some way to display images along a polyline on the map. I don't want the images to zoom in/out with the map, but I do want them to rotate with it -- the images are of various types of arrows, which need to be pointing in the direction of the route.
Is this something anyone knows how to do fairly straightforwardly?

Directions not following road on IOS map

I am working on an app where I give direcctions in a country. Directions in that country is not available from apple so i decided to use google api on an apple map. However as you can see from my sceenshot. Although I find the location on my iphone mmap i just get straight lines versus following the route that google does.
Does this have anything to do with using google API on Apple Maps? I have no reason why this is happening.
this is the link I pass to the web from my app
http://maps.googleapis.com/maps/api/directions/json?origin=15.299503,-61.387292&destination=Rosalie+Bay+Resort,+Rosalie,+Saint+David+Parish,+Dominica&sensor=true
If you are using MKMapView, you should check out the following examples:
http://www.meonbinary.com/2014/02/route-directions-with-ios7-mapkit-and-google-maps-api
http://sugartin.info/2011/10/12/drawing-route-on-google-map-mkmapview/
If you are using GMSMapView, check out this stack question: Drawing Route Between Two Places on GMSMapView in iOS
I know this is an old thread, but you are not getting 'weird' polylines..
You drawn them manually from the steps.
If you look closely on the right map, you see the 'white' dots ?
Your polylines follow these dots, you can name them the direction steps.
I have the same issue when I simulate the directions :) That's how I got here.
For just drawing, draw routeRequest.routes[0].polyline directly to the map, and it looks good :)

Road with traffic on MKMapView

I have a question about the MKMapView component. I saw that on the native "Map" iOS app, we can draw the roads between different points and we can display the traffic for those roads. Well, that's exactly what I want to do for my app :)
So, I have two questions :
1) Firstly, how can I draw roads on a map. I read a lot of things about MKOverlay, about some samples which do that with JavaScript in UIWebView but what's the best way to do this ?
2) How can I know the traffic on a particularly road ? In order to draw the road in green, orange or red.
Thanks a lot !
Regards,
Sébastien ;)
Unfortunately by now CLGeocoder class from iOS 5 is just supporting to process address to geolocation transformation and reverse. It means to find address around the geocode you have or to find geocode of the address you provide. There are no possibilities access road graph to create routes (to select and draw roads precisely) and moreover to control traffic on the exact place. The only things you can do with standard tools is to draw overlays on the MKMapView with your own data.
To achieve the results you want I would offer to use the third party resources, Google Maps API for example, and use UIWebView to present a customized map. Google Maps JavaScript API v3 TrafficLayer

Resources