MKRoute shown in US only - swift

I use MapManager to show the route. MKroute doesn't work in my country, but it does in US. Can anyone tell me if this only work in only particular countries or it does work everywhere?

The best i can tell is that, for a route, you need a destination and starting point.
When a coordinate preferably the current user position does not have a POI in map mostly due to the fact that apple maps is not completely mapped in your place. By which i mean its besides from showing some main areas and streets, you have nothing other then this feature will not work.
If you know what i mean, then the alternative solution is Google Maps. It has a vast resource and it has information about things apple does not.
But it comes with a price, you need to learn to use Google Maps API which at this point is documented for Objective-C only.
And the callout is somewhat static in Google Maps which you can customize but the hard way.

Related

Managing thousands of annotation's in iOS

So im making an iOS application where I have a map that contains thousands of annotations. And my question is the following:
The annotations are loaded from a site database and i query for new ones whenever the map is moved but this results in querying for the same annotation several times, does anyone know a good algorithm for not doing this?
And a follow up question: I only want to show annotations if im at a certain zoomLevel(I have implemented zoomlevels in my map just like in the googleMaps API). Can I somehow make some annotations invisible at a certain zoomlevel? In that case how do I do it?
EDIT:
Thanks for the tip Sanjay Chaudhry. Although I went with a slightly different approach for grouping annotations than what was suggested in the video. Although I still dont know how to effeciently query the server for annotations without flooding and querying for annotations already received.
EDIT2:
I still havn't found a good apporach on how to query for new annotations from the site without querying for ones already aquired.
Does anyone know some smart algorithm for splitting up countries into MapRects?
If you're a registered developer, watch the following video from WWDC 2011. It has a demo doing exactly that:
https://developer.apple.com/videos/wwdc/2011/includes/visualizing-information-geographically-with-mapkit.html#visualizing-information-geographically-with-mapkit
Essentially, if there are many annotations in a small geographic area, they're replaced by a single annotation as the map is zoomed out.
MapKit does a pretty good job of managing annotations -- it's often better to add as many as you can at once than to keep adding and removing them as the map moves. Annotations can be very small objects -- all you need is enough information to find the related data when you need it -- so you can add thousands at once without being too concerned about using too much memory.

Static maps with routing on iOS

Is there a way to have static maps on the iPhone, with either MapKit or a third-party framework? By this I mean fixed area of say, 5 sq miles, which can by zoomed/panned etc, but which doesn't require an internet connection to load the map.
Additionally, is it possible to get route directions, and draw them on the map?
You can of course always roll your own solution with CATiledLayer if the area you want to display is that small, but it's probably better and easier to have a look at routing frameworks like MapBox (http://mapbox.com/blog/introducing-mapbox-ios-sdk/), which provides offline support for iOS.
The MapKit framework doesn't offer offline maps currently.
It is possible to define an area on the maps, and lock the user into that area, but an internet connection is still required.
Maybe a more direct way to do what you want is to download a static image for the zone you are interested in and cache it, using the image of that map area to zoom and pan around in. Of course this would require an initial internet connection but that is really not such an obstacle, after all, one must have a connection to download your application.
You could also provide this image directly into your applications bundle, but you've not really told us much to conclude that the latter option is feasible.
As for routing, it's also not supported currently. You could however retrieve a list of waypoints from point A to B directly from the Google maps remote API - note you cannot do this with MapKit framework.
With these waypoints (which contain coordinates) and the current zoom level value, it's possible for you to plot these points and draw between each one in order to implement your own routing, this get a little ugly or maybe better to say "laggy" when the user begins to zoom in and out as it's only possible to know how to redraw your route when the user ends zooming (lifts their fingers from the screen), but of course like most things in programming, there is a solution to this which is, I feel out of scope for this question.
I hope this helps.

Looking for generic guide on using GPS with my own created maps - iOS

I have created my own maps of US states that I want to use in my app. I would like to use GPS to reference the user's position as well as various locations I have entered into my database.
Does anyone know of any guides for doing this? My main issue is in converting the known points on my map to something my app can understand and reference.
If you are new to this subject, the wikipedia article on map projection is really good and could provide a starting point: http://en.wikipedia.org/wiki/Map_projection

MKMapView, Google Maps API and traffic information

By the time you finish reading this question, it will become obvious to you that I'm pretty new to this development. But I've got a quick question here. I think I (unfortunately, sorta) know the answer, but I figured I'd ask, anyway:
I'm working on an app in which I'd like to display traffic data from Google Maps into a map. Easy enough, it seems. I can easily put the a MKMapView and center it on the desired location. I can also create a custom Google Maps API that I can look at on my browser, and it would display the traffic data with the GTrafficOverlay object.
Now...
Can I use the API traffic data (in Javascript) and parse it into the MKMapView implementation? I don't think so... right?
So, my only other option is to do a UIWebView instead, right? I just link to that page, and I'm good to go.
Also... Is there a major drawback to doing that? I know I lose a bit of the built-in interface, but beyond that, it doesn't seem to be that huge a difference, right?
And, also, if I want to use that Google Code API, how do I implement it in place? Do I have to have that HTML file somewhere in a server, or can I have it as part of my resources, or what?
Sorry about all the questions, but thanks in advance for any suggestions y'all might have!
You can't parse the javascript into the MKMapView implementation directly.
Yes you can use a UIWebView. I've only had a brief look at that, and it was pretty nasty with default behaviour, because both the web view and the map view try to respond to drag events etc. There is probably a way of tuning that out - you would want to look for SDK2.x examples as there was no other maps solution then.
This post may also provide a lot of help.

Can I use my own tiles in MapKit, instead of Google's?

I'm currently trying to decide wether to accept a client's proposal or not. Basically, I'm asked to create a MapView that displays markers at several locations on a map, with the additional requirement that the client's own map tiles are used instead of Google Maps'.
I do not know yet how the client stores their own map tiles, but I was assured that I'd be able to convert them into any format I'd need.
Is it possible to use different map tiles in MapKit's MapView?
Do you have good online literature about this? Links please?
If this is possible, I'd propably have to create a server that sends the files to the device.
How hard is it to create such a server? Is it just "setup apache, done." or is there more to it?
How hard, or time-consuming would both these things be, in relation to just setting up a normal MapView?
Thanks for your answers.
You can't use custom tiles with MapKit. You're limited to using the ones provided by Google.
It could be easier to create a "Google Maps-ish" web app that uses the custom titles and can be viewed on the iPhone through UIWebView?
Have you looked at alternate map frameworks on the iPhone? I know there is at least one open source map engine, also with tiles (that are not as good as the Google tiles, but hey).
A decent set of them is here:
Creating an IPhone Map application
The "easiest" way to do this within the Google Map framework is simply to map the client's map as a texture on top of the "ground." You can create textures at different resolutions, for different zoom factors. Then you won't need to do any special coding at all --- everything will just work.
The way you do this is with a KML region that maps to ground level.
See: http://earth.google.com/outreach/tutorial_region.html