iOS Mapkit - Cache maps? - iphone

I need maps of certain areas available when no internet connection is available.
It would be like this:
User loads app internet connection is available
App downloads list of coordinates and places pins on the map
User leaves their house and has no internet connection
Pins and map remain readily available for user to interact with, even without internet connection
How do I do this?

You probably won't use MKMapView and MapKit for that, but the Google Maps Static API that allows you to download static images (even with pins on it) directly.
Here is the example given by the Google Maps API doc itself
Then you can store this image and display it in an UIImageView in a UIScrollView for example.

Possibly the above mentioned Google API achieves just this, but another approach is to create a KML file using Google custom maps or some other service and then download and display it. An example can be found here. Alternatively, MapBox has this functionality built in. Go to this webpage, click command-f and search for "offline", and you will find the relevant information. One last suggestion- as an inelegant hack, if no other option works, you could try saving the html of the google maps webpage for the area and then loading that html file from your main bundle into your map view. I have no idea if that would work, but in a last case scenario it would be worth a shot.

Related

google maps in UIWebView passing data from core

I want to use to UIWebView to display google maps mobile website for my app. However; I need the current user location to be passed into the webview so that it may show a route. What steps must I take in order to not only pass the current location to the google maps url but also pass what I want it to route(for example, Costco)?
Second, my app is going to be a paid app and I was wondering if it is even possible to use google maps due to this? The app does not only have gps but other sections as well that I created myself.
Thank you so much
I think you dont want to show google-maps in an UIWebView. You should use either the MapKit-Framework or any other maps-framework like for instance route-me.
In both framework it is possible to draw polylines (links: MapKit, route-me) (which represents a route) and any other stuff like pins and a bubble with a circle around it which indicates the current location (links: MapKit, route-me (should be somewhere in the sample-programs)).

how to create customer map on iPhone without using Google Map

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

How to implement google maps in my iPhone application

I am totally confused with google maps and maps of iPhone...
i have read that iPhone uses google maps.....and also spent some time on it....
But it never display the items like location pictures, balloons etc.
EDIT
THIS is photo for of browser
and following is same place for iPhone maps
second one did not show the annotation added by people.....
(this is what i was asking for ballons or other pictures which people adds to location on oogle maps)
I want to display all those in my application....
what should i do...
if you suggests implement Google maps API, then please suggest a working link...or provide some sample code if possible.....if anybody has done it...then please mail me at yogeshkumau#gmail.com
waiting for answer......
Points of Interests(location, pictures and baloons) that you are talking about can be shown in your maps, if you acquire the license for Google maps premier api. In that case you'd have to use dynamic maps by using google's web services. However if you want to implement it using MapKit framework on iOS devices, you'd have to draw your custom POIs using core graphics.
Apple has a special agreement with Google to use their maps on their platform. The internet is packed with examples of usage of MKMapView along with annotations (pins, there're no baloons on iPhone).

Offline map from sdk

In my application i have a MkMapview and now it shows current location. i have to bookmark some other locations and show that locations even if there is no Wi-Fi connection. How to bookmark that locations and how to display the offline maps? how to save map to cache? is it possible?
Thanks,
As far as I know, there is no public available API for caching the map images used by MKMapView. You might also be in violation of Googles terms and conditions by doing this.
However, Google have provided a static map API where you can grab a static portion of a map as an image file and possible cache this for later display. But again, check Google's T&C.
There are a number of other map services available through the GData API, but they are somewhat more complex to use. This SO question, shows a few hints on how to use these API's.

Force MapKit use cached map tiles only/disable network programmatically

We have stumbled upon such a problem.
We are developing an application for travelling. To make sure the user doesn't spend much money on roaming charges in our app we decided to implement a settings option for user to view cached maps only. So we let the user decide whether he wants to load the maps from internet or he wants to save money and view cached maps (stored in Library/Caches/MapTiles/MapTiles.sqlitedb).
We can't find a way to implement this. Is there any way to disable network programmatically in this case? Or force MapKit use cached tiles only? We thought about changing APN programmatically for this option to force MapKit go offline. Is it possible to change APN programmatically?
Thank you!
iPhone SDK apps do not have access to the network adapter settings, and I know of nothing in the MapKit API that gives you control over its Internet usage. Your best option in this case is probably to present an alert suggesting that the user enable Airplane Mode or turn off data roaming.
use openstreetmap
think the commercial side of it Cloud-made allows offline maps
http://developers.cloudmade.com/projects/show/iphone-sdk
Libraries that help iPhone developers use OSM maps
route-me is an open-source library used in a number of iPhone applications to display OSM maps.
The CloudMade iPhone Maps Library is an open-source library that provides high-level access to CloudMade's OSM-based map tiles with different sizes and different styles.
John McKerrell has ported the routing algorithm from gosmore to run on the iPhone and has successfully generated basic routes. More complicated routes crash the iPhone at the moment
There are some ways. One is to use your own tile overlay and implement the caching algorithm either in URLForTilePath: or in loadTileAtPath:result:
It works very well with open domain and some private ones. Does not cache the standard Apple Maps.
Another way that will be able to cache everything is subclass NSURLProtocol. There are some tutorials and probably you may detect when is a map image and act accordingly
the google map app does the cache feature ... MapKit seem no , I think Apple will add this feature in next version SDK ...