I am working on a project that involves computing a custom route from a particular origin position to a destination on a map. Ideally, this application should be able to give live walking/driving directions for this custom route, or it should able to send this route to the Google Maps or Apple Maps apps to handle the navigation.
Is there a way to accomplish this using the Google Maps SDK or with Apple'sMapKit (or any other framework)? In theory, for short routes, this could be accomplished using the Google Maps waypoints feature, where points along the desired route are pre-specified, but the API is limited to 23 waypoints, which would become problematic quite quickly.
In essence, I want something like Google Maps, but with the route determined by my own algorithm rather than Google's.
For custom routes, you could use something like Skobbler or MapBox.
Related
Is there a way to change the style of the default traffic lines that appear when MKMapView.ShowsTraffic is set to true?
Thank you.
As you have probably already found out, the farthest you can go with traffic styling is exactly that one boolean variable showsTraffic that either shows it or not. MapKit is not really customizable apart from annotations and that's what you have to live with if you're not willing to use a 3rd party map provider. In my mind you have two choises:
Use a custom tile renderer with MKMapView
You can use the MKTileOverlay class coupled with the MKTileOverlayRenderer to fetch map tiles from a 3rd party service that supports tile fetching and customization, and then show those tiles instead of the default Apple map. One such service is Google Maps Tiles API but you need to request access to it from Google (it's not part of the normal Google Maps API) and it's paid.
If you're still willing to go that route, you can follow the Customize MapKitās MKMapView with Google Maps styling wizard article on how to create your custom style and use it to request tiles from the Google Server. However, you should NOT use the Google Maps API address mentioned in the article, as circumventing the official Google API's and making requests straight to their servers is strictly not allowed and will get you banned and/or in trouble. Instead, you should use the official API I linked to above.
Use another map control altogether
I'm fully aware that the above is a lot work for just customizing the traffic lines, so if you're not willing to invest a lot of time and money, I'd suggest that you use another (customizable) map control instead of MkMapView. There are plenty of different options available, both free and paid.
I'm making an iOS app that needs to be able to find the most populated cities within a radius from a certain point, and to calculate a route that passes through a certain number of those cities, that satisfy a certain time constraint. I'm planning to use Google to give me polylines that I can put directly on an Apple Map in the Mapkit for Xcode. I've looked into the Google Maps SDK for iOS, and Google Places. Google also has a Directions API, and a Distance Matrix API. With so many API's, I'm slightly confused about which one I should use, and for what.
Additionally, do Google API's provide city population, or should I find that via another database?
You can use Google Maps URL Scheme to get directions for Google Maps iOS.
If you are ever confused about which API to use for Google Maps, you can use API picker.
There is no Google API that give city population, so you would need to find it with a another database.
My first question here. I'm hoping I'm doing the tags and such correctly so the right folks might be able to see this. If this question should be placed in other area, please let me know.
I'm trying to create a link to a set of custom driving directions that, when clicked from the native iOS Mail app, will open the Google Maps iOS app and populate the custom directions.
I have a map which has driving directions from Point A to Point B, but I've significantly revised the route using the click and re-position functionality in Google Maps (web).
Using the share function from Google Maps (web) creates a link that does in fact retain the custom route, which can be seen when the link is clicked and it opens in Safari. I don't mind that it opens in Safari, since at this point it prompts you to open up these directions in the Google Maps app. But here's where it gets muddy.
When you click the "use the app" button from Safari, the custom route does not carry over to the app. You are shown default route choices based on Point A and B.
The Google Directions API section on Waypoints and using the 'via:' prefix seems like the best way around this, but I'm not sure how I'd turn that into something clickable from an email.
For reference, here is one of the maps I made with a custom route. Basically I want to have it go from Point A to B along one road. I had to make a handful of points along the route in order to keep the route on the same stretch of road.
Further complicating this is Google's attempt to reroute even this map, based on real-time traffic. I went back to this link after copying it here to find out there's an accident on this road right now and it's re-routing through side streets.
Any help would be much appreciated.
Well, you can open the google maps as it follow as it is documented in the documentation:
comgooglemaps://?saddr=Google,+1600+Amphitheatre+Parkway,+Mountain+View,+CA+94043&daddr=Google+Inc,+345+Spear+Street,+San+Francisco,+CA¢er=37.422185,-122.083898&zoom=10
However, there is no mention on how you can add waypoints. And, indeed, you can not even do it in the Maps App. So there is basically nothing we can do...
BTW, here is a blog where included some work arounds, hope this helps a little.
here is what i do : long method, but it works.
open google my maps (instead of google maps) and make your custom route.
in options, export your route to KML/KMZ
at gps vizualizer com, convert your route to the format your app accepts.
I am trying to develop an iPhone app (with map routing function), and I need everyone's suggestions (guidance).
Below are a few specs:
The app will be running on iPhone with iOS 4+.
The app will have Map functionality.
In the app, given a "few locations" in a given order (to make things less complicated), the Map will draw routes between each locations on the Map.
Clicking on any location will display another page that shows some information about that location.
Can choose alternative route between two location (which I don't think is possible, but let me know if anyone know any framework that can do this).
I did some research, using Map on iPhone is easy using MapKit (and it's available after iOS 3.0). I followed this tutorial, and everything seems easy. However, if I want to draw routes on my map, I will need routes data in a CSV format. However, I do not have those data (yes! I suck).
And prior to iOS 5.1, MapKit use Google Maps, and I read somewhere that in Google Map's term and condition of use, it prohibit people from drawing on the Map (correct me if I am wrong).
In order to retrieve route data, I would imagine that I will have to get it through Google or Apple (I don't know if it's possible). I'm just wondering if Apple Map or Google Map have API to retrieve these?
If not, an alternative I came up with is to use a webview, and display my Map routes on Google Map. I'm just wondering if Google Map API will allow me to insert multiple locations and display all the routes?
I really need some suggestions... I am getting buried in all these problems.... thank you
Follow this sample - MKOverlay is the way to go. One more example is here.
I have looked for hours for what seems like it should be a trivial task.
I simply want to draw a route through a series of waypoints (which I have as both address strings and geoCoordinates).
The Imagery API lets me do a query for a static map, which seems to be a common solution, but I was hoping to draw the route on the dynamic, interactive map provided by the Bing Maps iOS SDK.
Thank you.
"draw the route on the dynamic, interactive map provided by the iOS SDK." Is this to say that you want to use MapKit on the iPhone?
If that's the case then you can look at this: http://iphonegeeksworld.wordpress.com/2010/09/08/drawing-routes-onto-mkmapview-using-unofficial-google-maps-directions-api/
The only problem with that is that you need to decode the polylines, which you can do by following links in that link and modifying that code to suit yourself.