In order to get directions, Google provides this nice URL:
Sample here...
How can I use the information that Google provides to get the same direction line on a MKMapView in an app?
You will have to either use a web view with a Google map, or draw on the MKMapView with overlays. There are a couple of projects on GitHub that do this:
https://github.com/kadirpekel/MapWithRoutes
https://github.com/kishikawakatsumi/MapKit-Route-Directions
In iOS 5, you can also open the maps app using an openURL call to the link you specified, and it will give you multiple possible routes to the location.
Unfortunately, the way to do it with the built-in MKMapKit is to calculate the route using some webservice then using MKOverlays to render that line. Those tools suggested by neven are probably a good first start.
Related
Until iOS6, it was possible to use Google Maps API with optimize waypoints parameter for showing an optimized route between many locations. The route on map was shown on UIWebView or in Safari. With iOS6 everything has changed: Apple Map Kit now uses Apple maps, so its illegal to use Google Maps API in it. Currently, MKMapItem allows to call and pass MKLaunchOptionsDirectionsModeKey. However, currently it allows to use only two locations. Is there any workaround for that?
Their is a open source class files RegexkitLite that use to find path between two places
follow this documentation for implementation.
please go through this it solve your problem.
[
I'm making an iPhone location based app and I'm having trouble with the last aspect of it. I was wondering if anyone knows how to integrate a search bar that correlates with the map that we can use from MKMapView.
It's literally a search bar above the map that the user can type in an area and it will take them there.
Is this possible?
I've looked around for tutorials but I have only found how to make an app with a map view, annotations and adding callouts.
What you're looking for is geocoding - the process of turning an address in your search bar into a latitude/longitude coordinate, which you can then set the map's position to.
This question has two main answers. This answer shows how to geocode using a Google API, and this answer shows how to geocode using an Apple API.
If you're using MapKit (which uses Apple maps as of iOS 6.0), then you should probably use the Apple API (you are not supposed to use Google Maps APIs with non-Google maps).
If you're using the new Google Maps SDK for iOS, you might want to use the Google API for geocoding. Although note that the answer I've linked to is using the Google API with MapKit (as it was written back when MapKit was using Google Maps), so you would need to modify it a bit.
I've noticed that the maps app integrated in iOS can show the traffic, but is there a way to do that using MKMapView? or that functionality only appears in that app?.
Any help please?
The data Apple uses appears to be sourced from TomTom and others. If you can find an API that provides traffic data, you can use a MKPolyline to render the data.
As far as I know you can't show the traffic information using the MK framework.
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
I am trying to implement a feature to get directions from my custom mapview. The get direction feature is exactly like the one in map app in iphone. I am a bit clueless to start with this feature. Any suggestions will be apppreciated
there are many links available stating the same. You should have look at the same. Like the one given below :
Drawing a route in MapKit in iPhone SDK
To get the routes you need, use Google Directions API. If you are using Three20, you can use extThree20Google extension
I'm trying to integrated in our iOS app. Due to the bad relationship between Google & our government, Google Map is not a good idea.
We have bought a local map service company's javascript & Web Services based SDK, now we want to use it on iOS. But it seems that MapKit does not support customer tiles.
So here are my current ideas:
Use UIWebView. But I tried that map in Safari, I can't drag to move the map nor use two fingers to zoom. I think I need to call some javascripts while touch events happens.
Build a costumer UIScrollView, download map images and display them using iOS sdk. But that map service does not have API to download images, I tried to read their 200KB+ undocumented javascript to find out the relationship between location & image files, but I got no results for now.
Both the two ways could face certain legal risks. I'm not sure what the purchase contract is like.
I need suggestions about the two ways or some new ideas. Thanks guys.
There are a couple of non-Google map implementations available on github that you might be able to use (linked via CocoaControls):
NAMapKit
MRMapView