Using Mapkit offline - ios

I would like to use the Mapkit framework in my app offline, so the user does not have to use roaming to download the tiles. I have seen other maps using google maps and have the tiles in the app without having to download them first.
How could this be done? Could the cached tiles in the cached.db saved somewhere in the project so they are there by default?
Would I need to create an overlay?
I have seen a number of similar questions, but I am still thinking there might be an answer somewhere out there. Is it really disallowed by Google to use their map images offline?
I know that I could use mapbox, but I am also sure the examples I have seen are not using mapbox.
A thread among many that I have searched:
Offline MapKit solution for iOS
Many thanks!
Andras

This is unfortunately not possible on iOS, there´s neither an API for caching nor is it allowing in the Terms of Usage. As you already stated the only way to allow offline mapping is by using other Map frameworks like Mapbox. MKMapView however does cache a few tiles as long as you loaded them while you had internet connection, you just don't have any control over how many tiles get cached or how long they get cached.

you can use overlay technique.Just download one geojson file and fetch data from that which contains coordinates.Plot those coordinates by using overlay.
This method will show your overlay as map in offline mode.

Related

Mapbox iOS Search by Attributes or Features

I have a common use case that I haven't found documentation or examples on. I've added data to my iOS Mapbox app via TileSets in MapBox Studio. I'd like to simply implement a UISearch function on the data in that Tileset using some attribute. For example, I've added a TileSet with 100 different roads in some county in Alaska, and I'd like the user to be able to search for a specific road in the search bar. This seems like it should be easier than I am making it, but I've been working on it for weeks. The original data is geoJSON but I'd like it to be hosted in MapBox Studio so I can update the data without needing to update the app once its released.
Note that this is different than the visibleFeatures function which returns MGLFeatures by location or Rect. I really just need to get all features list from a layer so I can populate it in the UISearch functionality.
Any suggestions? Much appreciated.
Update after talking with Mapbox customer support and folks familiar with how to do this.
Two ways to query features in map:
(1) use the MapBox visibleFeaturesAt() function for features within the rendered map: lots of documentation on this. But this is limited in that it only returns features nearby to your mapview camera. If you want to do a big global search, can't rely on this. So second option is
(2) for global searches, transition to using an external database outside of mapbox. Mapbox isn't designed to be searched up globally for features like this question. If you want to search an attribute that is unrelated map-wise to current view, start using a back-end database like FireBase.

How to use custom offline map in iOS app

I'm developing an iPhone offline map application. I've illustrator map georeferenced (using mapublisher), have geodatabase (http://goo.gl/isw6IP) and parking data (shp/csv).
Requirements:
The map should Pan, Pinch & zoom.
Search addresses and parking (addresses have alternate names too) on map.
Routing/Navigate to parking/address.
GPS Positioning.
App will work offline without internet connection once installed.
Questions:
In which formate I should export the illustrator map, geodatabase & parking data to be used in a iOS app.
Which iOS offline maps SDK is recommened for above requirements.
Few iOS SDKs like Route-ME, MapBox, Alpstein, Altus, Skobbler, cloudmade, ArcGis iOS SDK, nutiteq etc are using OSM data or their own hosted MAP data but I want to use my own illustrator map and all data will be available local for offline use.
I've search alot but could not find any concreat solution. Few links in my research.
http://goo.gl/m9Lp1w
http://goo.gl/IMKF4p
http://goo.gl/gsrv5Q
http://goo.gl/J4Ne5y
https://goo.gl/1wP29H
Same question (similar to what I need) was asked long time ago but without any answer
http://goo.gl/knoA1C
1:
In my opinion, OpenStreetMap is the best one for all-around purposes such as the ones you mentionned: addresses, parkings, routing, maps.
You can answer all requirements with that format. Depending on your project, you may better transform your data in a specific format for each requirement.
2:
You'll probably have to use a few components to match all requirements :
The map should Pan, Pinch & zoom.
Any of the SDK listed will do it.
Search addresses and parking (addresses have alternate names too) on map.
You can query a local database then create markers.
Routing/Navigate to parking/address.
I would recommend GraphHopper
GPS Positioning.
It can be done manually using CLLocationManager. Create a marker (according to the chosen SDK) then update it's coordinates.
App will work offline without internet connection once installed.
That's the main requirement. You have to chose between vector and raster first, then pick the SDK. You'll probably have to make a few transformation here.

Offline Map for Private Property with Navigation in iOS

I have an idea of building offline Map for my University Campus (its covering almost 3-4 miles). Like new students or guests can navigate to various blocks in campus. Student can see himself/herself marked on map at current location & can chose destination from pre-defined list of places and application will navigate them.
I have explored alot like maptiles can help me in showing maps. But is there any other efficient way of showing campus map ? And I have no idea how will I navigate user (since being a private property area is out of reach of Google's Maps (or some other) API).
Any suggestions will be helpful. :)
EDITED
Here is Google Map link to my place.
I am studying ArcGIS from last few days, learned to create its 'geodatabase' using 'ArcGIS for Desktop' for rendering offline maps on iPhone.
However, now my concern is how to Navigate user.
And I will welcome any suggestion/idea for accomplishing it using any different approach.
You can achieve that with MapBox.
MapBox is an alternative to GoogleMaps and supports offline maps.
Mapbox iOS SDK
There are three methods available to the Mapbox iOS SDK
for offline maps. With cache-based methods, the RMTileCache for an
RMMapView can be configured to keep map tiles around based on their
count or based on their age in the cache.
Caching based on previous user interaction
Tiles are automatically cached once they are downloaded for display
based on the user’s panning and zooming of the map. For example, if a
user views the map, then zooms out, then zooms back in later when
offline, the original tiles will be present in cache and will display
without need for a network connection.
Proactive background caching for certain map regions
Using RMTileCache and the RMTileCacheBackgroundDelegate protocol, the
developer can enable the user to download a certain bounding box and
zoom range in the background in advance of actually displaying them on
screen. Callbacks trigger, allowing the developer to report progress
to the user or even to cancel a download in progress.
Tiles that already exist in cache will be skipped over during this
background download instead of re-downloaded.
MBTiles prepackaged tiles
Using the MBTiles format for map tile storage, developers can build
apps that read the tiles straight out of the MBTiles file and do not
ever need a network connection. Since MBTiles is an open format, files
can be created manually or with TileMill, as well as many other
applications and utilities such as mbutil.
You need the last one (i.e. MBTiles prepackaged tiles).
Source: https://www.mapbox.com/help/ios-offline/
If you go the OpenStreetMap way (map your property directly in OpenStreeMap) then you can also use the Scout SDK.
It's OSM based and provides full support for offline maps, offline routing & TBT navigation. If you properly connect the road segments then the SDK will be able to create car, bike & pedestrian routes on your data.
While not free, the Scout SDK has a free tier that might be large enough for your particular needs (if not you'll move to a "pay-as-you" model)

How to store openstreetmap data locally on an iphone

I'm working on a project for college and I'm having great difficulty with part of it.
Simply put, I am looking to do the following 5 things:
download the open street map data for my city
store that data locally on the phone's harddrive.
view that data in my iOS application as a map
place markers on the map.
draw paths along roads between those paths.
I have been working on this particular part of the project for a number of weeks and I'm getting nowhere with it. I haven't even been able to figure out how to store the map on the phone let alone view the map data. I've tried using the "Route-Me" library but cannot get it working (although it seems to be one of the best libraries for using openstreetmap data so I am looking to learn how to use it). I feel pretty goddamned defeated.
If anyone has accomplished any of the tasks I am trying to do could you please link me to tutorials/guides/videos that you have used.
I'm not looking for people to give me code or do the work for me, I want to learn how to do this, but if anyone can point me in the right direction of sites that I could learn off I would be very grateful.
Any advice or feedback would be much appreciated
Here's how I ended up solving the problem.
Since Tilemill doesn't natively read .osm/.o5m/.pbf files I used Osmosis to convert a .osm file into .shp files.
I then created a new project in Tilemill and added the particular .shp files I wanted as layers to the new project. It takes a little bit of tinkering to get the map to look like you want it to but it's very similar to css and pretty easy to pick up as you go.
Once I had the map looking the way I wanted it I exported it as a .mbtiles file. This takes a long time to make and the files can be very large depending on how detailed the tiles are. I did one map of Ireland with zoom levels between 7-14 inclusive and I did one map of just Dublin city with zoom levels of 11-17 inclusive. Even though the map of just the city of Dublin had much less tiles, they were both ~200MB in size.
I then found this tutorial online which explains how to store the .mbtiles file in you application and how to read it: http://martinsikora.com/creating-mbtiles-db-for-ios-mapbox-from-hi-res-map-image
Here are a few other links that I found useful:
http://www.kindle-maps.com/blog/using-tilemill-with-openstreetmap-data.html
http://mapbox.com/developers/mbtiles/
http://mapbox.com/mapbox-ios-sdk/api/
http://mapbox.com/developers/api/#static_api
http://support.mapbox.com/discussions
I hope this is useful to someone
I would suggest trying the MapBox iOS SDK. It is actually forked from the Route-Me library and will allow you to accomplish everything on your list.
A key point to remember is that you have another step in between downloading the OSM data and storing it locally on the iOS device, that is, generating the map tiles and storing them in some sort of database.
Here is an example iOS app using the MapBox SDK that has both online and offline map sources and is a good place to start.

Offline Map With Routing - iOS

I'm working with a project its related to Offline map application.Because of that I searched for offline map which shows the defined area. I used MapBox for offline mapping. I can add annotation on this map and draw lines.
But my requirement is offline map with routing. I was fed up to find a offline routing library or offline routing engine to embedded to Xcode.
Appreciate if any of you have any clue or sample project/code to implement this
Note : This question is related to my one. No one replied to this as well
Thanks.
Offline implies no internet, the iPhone is still able in most cases to get the users current location from the GPS. That means that you can be quite confidant that you can find out the current location of the user whilst offline.
The problem with offline routing is that the Phone is dumb, it only remembers the x amount of MB of data in terms of tiles to display.
Routing is something completely different, it takes a point A and B and works out the shortest, fastest, cheapest or all of those between A and B.
This takes a lot more then tiles to accomplish, after all if you think in terms of MVC, tiles are just the dump views, they don't know much about what's around them except what's inside of them. It would be the "controller" who would calculate routes, and for that you would need to be in possession of all the data spanning the desired area for routing.
For each mapping service you will find a different route, maybe not in terms of actual path, but in estimated time, effort etc, what this means is that if you have your own maps (offline in a database), it's up to you to use that data, so you should make your own routing algorithm which I'm sure isn't what you want to do.
So what are your options? At the moment this just isn't possible in the scope you want. Even if you had an offline maps database, you still need a routing algorithm.
In offline case also you can get the current location by using only GPS and you can draw overlay lines from current location to the interesting point for that you have to do some calculations
You can make offline routing by using graphhopper library by making graph data which contains (Street names, routes,edges) . Graph data is taken by .pbf file which can be taken by (Use this:http://download.geofabrik.de) and use commands(in Terminal) that was given by (https://github.com/graphhopper/graphhopper-ios/tree/master/graphhopper-ios-sample) to convert .pbf into graph data. Then we can make offline routing with its instruction (All given in graphhopper iOS sample).please refer that carefully. because i have done and finish my project successfully.

Resources