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/
Related
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.
This question already has answers here:
How to convert a 2D image to 3D in iphone app [closed]
(1 answer)
iOS - 2d image turn into a 3d
(4 answers)
Closed 9 years ago.
I need to convert a 2D image into 3D in my ios application. How would I do this in my ios application? What are the frameworks I need to use? Will OpenGL-es helps in this? Or are there any other packages in IOS to do this? What are the steps do I need to follow to make a 2D image to 3D?
I'm not sure how you plan on doing this programmatically as a 2D image doesn't have any Z-axis information other than 0.
Take a simple 2D square for example and you want to make it into a cube. Your square has 4 points of data representing its corners: x1y1, x2y2, x3y3, x4y4. To "convert" that square into a cube you now need to add the z-axis data on those points AND provide the coordinates for the missing 4 sets of data since your cube has 8 coordinate references (x1y1z1 - x8y8z8) AND provide which points are connected to each other. That's just assuming a planar shape with no other depth or curvature. You also have no idea what the non-visible sides of the 2D image look like.
The only way I can see this as even slightly feasible is if you allow the user to add their own points on the screen (allowing for manually editing of depth since your screen can't infer depth) and decide which existing points to connect the new points to. At this point, though, you're no longer doing a conversion...
I think you should clarify a little bit what you are trying to achieve. There are no ways that I would know of to automatically find depth information from a single 2d image.
However, if you are talking about something shot in stereo, then you could look for features present in both images and figure out the depth of each feature relative to each other.
And in the case of a video or image sequence, there are a few interesting papers, but one approach I find specifically interesting is "Depth Extraction from Video Using Non-parametric Sampling" by Kevin Karsch, Ce Liu and Sing Bing Kang.
you can find it here:
http://www.kevinkarsch.com/depthtransfer/eccv12-depthtransfer.pdf
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Any one know of an OpenGL ES example of an interactive globe/earth for the iPhone
I'd like to build an app with a spinning 3d globe and a few points of interest on, which the user can interact with (zoom in, click on point of interest, turn and stop globe etc). I've seen an example of how to build a sphere using OpenGL ES and Cocos2d-iPhone (neither of which I have any experience with) but I wondered if this is the best approach, as both the examples I found seem to have no user interaction enabled.
What I would like is for someone to advise me the best way of building this? Should I use OpenGL ES or Cocos2d-iPhone or is there some other way that's better (considering I'd like the user to interact with it)?
I have the co-ordinates I need, but I'm unsure how I would even go about mapping them onto a sphere. Should I use a textured Image on the Globe? And then how would I go about adding the interaction>
Any advice would be really useful as I seem to be going round in circles with this (pardon the pun).
Thanks in advance!
Thanks Brad - eventually we found this link which provides the source - which is pretty cool (and free), so thought I should share:
http://www.scoop.it/t/ios-developing/p/628999997/whirlyglobe-for-ios
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.
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.