iOS 7 MKMapView Does not provide a route between two points - iphone

Hi there am using the Map Kit, i did add several points based on Lat & long Data, so far, it's all good. I Did try to implement the MKDirections methods but i get this response: A route to the destination from its nearest road cannot be determined, NSLocalizedDescription=Directions Not Available, MKDirectionsErrorCode=7, MKErrorGEOError=-403
My question is: If i somehow own the data of those routes between two points, is there a way to draw the route using the MapKit instead of asking apple to provide a route?
thanks in advance for your responses

Yes, you can draw a polyline, if you know the sequence of lat,lon coordinates along the road from start to destination.
Apples BreadCrumbs demo code shows how to do that.

Related

Route following simulation in iOS

I am working on moving a map annotation along a route that has been mapped out in iOS, but I wanted it to follow the path given for the directions. So to be clear, I want a simulation of the user following the route of the map without actually doing the route. I have tried doing research and yes, I have seen the breadcrumb tutorial but I am really unsure how to go about following a route as described. Is there some way to get the map with the route broken down into points/data?
Any help or links are appreciated.
Change and animate the coordinates of the annotation along an array of coordinates.
But this requires that you have the "route" as sequence of coordinates. The apple route you will not get as coordinates.
You could use OpenStreetMap to get a vector based route (coordinates).

draw route on static image map iphone

I'm developing a campus navigation app.
I have an image which displays building on the campus.
I want draw a route from the user location to destination building the use wants to go.
Wondering how to draw a route on static custom image.
Been searching on internet but cannot find any clue how to develop.
All documentation on internet are about drawing route on Google map.
any hint will be much much appreciated.
You'll have to manually collect latitude and longitude information for each of your map image's four corners. You'll also have to manually specify, in terms of co-ordinates on the image, the position of every possible turning point in the building's corridors, stairs etc. Then you can get the device's current latitude and longitude (see the Location Awareness Programming Guide), translate it into a position on your image, and overlay a transparent view with a red line on it stopping at each of your manually collected waypoints. There remains the graph theory problem of finding the shortest route through the network of waypoints. I suggest the A* algorithm.

drawing routes on MKMapView [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Adding a route to a MKMapView
So I am planning to draw multiple routes on the MKMapView. What are the easiest way to do this on iOS? I am not sure if the iPhone can calculate routes if I give them two points (lattitude, longitude). But then if the iPhone were able to calculate a route, then that route might not be the route I want to draw to go from point A to B.
Do I need multiple points along the route and draw it? As that seems really complex, as the number of points grows linearly with the growth of distance. Any suggestions?
Try these posts.. It will help you i think
http://navarra.ca/?p=786
http://spitzkoff.com/craig/?p=108
This will automatically use Google Direction API and will fetch the points in between the locations i guess..
Anyhoo see this blog http://laurilarjo.wordpress.com/2010/10/23/using-google-directions-api-and-drawing-routes-in-iphone-mkmapview/

iPhone: GPS on custom map + CATiledLayer

Really hope someone can help me as I'm a bit stuck :S
I have a custom map of an event using the CATiledLayer so users can zoom in and scroll around the map. What I would like to do now is add the functionality to let the user know where they currently are on the map. I know it can be done as I've seen an app do this before. I'm not sure how to go about doing it though, maybe I need to convert lat/lon into pixels but I'm not sure if thats possible (depending on how big the image is, etc).
On another site it was mentioned to find out the boundaries of the map and then I can add pins to the map, but I'm not sure how to go about doing this? Will I need to find every coordinate (lat/lon) within the boundary so I can add the pin of where the user is currently?
If anyone can give me with any advice or pointers, I'd much appreciate it
You can use the route-me library by adding your own map source class. A good article that explains how to do it is here http://mobilegeo.wordpress.com/2010/07/07/route-me-native-iphone-mapping-framework/
I'm facing a challenge right now in trying to map GPS coords to a map that's an artist's rendition. In particular this is for a ski mountain, so the artist's rendition is a "trail map". The trail map is not accurate in that the whole mountain has been squeezed onto the one view, yet the actual topology of the mountain doesn't conform to the drawing.
I've tried several approaches:
1) Triangulation using known GPS coordinates of the lift stations. This is fairly simple to implement, yet this is not accurate enough and the algorithm fails if the rendition differs enough from the GPS map.
2) Creating a uniform grid for both the GPS map and the Trailmap, then doing a mapping from cells in the GPS map to the Trailmap. The downside to this is it can be a lot of busy work with no easy UI for doing it.
3) Calculating the vectors of each lift (being a straight line), find the closet lift station to a given GPS point, and calculate the estimated Trailmap location using this vector.
I'm considering #2, which is essentially the simplest solution. But if you've found a better way, I'd love to hear it.

polyines on iphone

I want to know how to display the route between two Points on
map using mapkit framework in iphone
Is there any Api that can used to display the route between two
Pins. If not Is Polyines is standard to show route between two
pins.Can we display the route on Map with the help of polyines on iphone
or is it dummy route between two points.
Thanks in advance
There's a nice sample on how to accomplish this with a custom MKAnnotationView here: http://spitzkoff.com/craig/?p=108
You can find a working example at http://github.com/leviathan/nvpolyline This solution is especially targeted at iPhone OS versions prior to v.4.0
Although it can also be used in v.4.0 Hope this helps.
You could use Quartz to draw your lines.
Get the context of your map view
Move to the point of your first pin
Add a point to the point of your second pin
Configure your stroke (line-style, width, color)
Draw
A good tutorial about drawing with Quartz:
http://www.cocoadevcentral.com/d/intro_to_quartz_two/
If you do this you will have your app rejected. You are not allowed to use the Google Map tiles (and thus MapKit) for routing.
You can use one of the open map frameworks, they may also support API's for drawing routes atop them. I would explore that before figuring out how to draw your own polylines.