Offline Map With Routing - iOS - 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.

Related

Offline map with routing on iOS

Anybody know good solution for offline routing on iOS?
I read some posts but no solution. I know that ArcGis can do it, but they have an expensive plan.
Another good idea, we have an offline map and when we need routing we will go to internet.
But it should be the same map. If anybody know how to do this tell me please.
Offline Map With Routing - iOS
Offline iPhone Map with offline routing
Offline maps with routing for a particular place
Offline maps on IPhone
In my opinion, Graphhopper is the best choice for offline routing. The project is quite active, relies on OSM data, can be embedded or consumed as a service sharing the same core logic.
I have successfully integrated it in a few projects (mostly foot routing in indoor/urban areas).
Depending on your needs, you might have to adapt a few lines of Java code.
About your second subject, think of map and routing as two different features, even if a few SDK provide both.
You can rely on graphhopper to compute an itinerary then represent it on a Arcgis's AGSMapView.
https://github.com/graphhopper/graphhopper-ios
See http://wiki.openstreetmap.org/wiki/Frameworks and http://wiki.openstreetmap.org/wiki/Routing. The entries for some of the frameworks specify whether they can do off-line routing. These wiki pages refer to systems which use OpenStreetMap data, but some of the frameworks can handle other data (e.g., ESRI shapefiles) as well.
Disclosure: I am the author of one of the mapping SDKs mentioned.

how to display routing data online (with the lines between points)

I have a set of routing data, in both CSV or KML format. It is basically a list of Lat / Lon and some supporting information.
I am looking for a way to display this as a route (e.g. with lines between the points in the order they appear in the list) online. Ideally a free option, as I'm not likely to need it again in the near future.
I have found hundreds (maybe an exageration) of ways of plotting the points, but not one that will include the lines. I'm trying to avoid the long and tedious process of converting one of these to an image and drawing the lines by hand.
Can anyone suggest such a site?
This question was asked on a google group for google maps. The user received an answer that pointed him towards the google map API. Given how other apps / web pages do this using google maps (never seen it done any other way) I would imagine this would be the best route to go down as its probably something they have built into the service.
https://groups.google.com/forum/?fromgroups=#!topic/google-maps-js-api-v3/F_iroBiBeww

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.

Mapkit. Getting nearby places from a server and possibly caching them (e.g. for offline use)

I am developing iOS 5 app which I want to communicate with server providing information about the nearby places for a given location: places locations and annotations. I want to use MapKit to populate my map with this information.
I didn't find any straightforward information regarding the following questions:
Does MapKit has tiles functionality (Google Maps way) out-of-the-box and do I need to work on it additionally, if not?
What is the best practice of retrieving places information (markers positions and annotations) from server?
Is it possible to cache this information so an user can see the nearby places of "his city" in offline mode?
Actually questions 2 and 3 are interrelated: they both address the problem of not retrieving an information (locations + annotations) that is already on map multiple times.
Hopefully I am not overlooking something obvious here.
Thanks!
Update 1: (Regarding places, not maps) More specifically I am interested in, how should I create a "hand-crafted" logical tiles for regions containing the places I fetch from the server, so they would not require refetching themselves when user scrolls the map? I know I can dive into implementing this functionality myself. For example, should I write the places just fetched to a local storage using Core Data immediately after fetching them or organize some queue? Or how could I know when I need to perform a request about the specific region on server and when I just fetch local data that is already on the device? I just want to know, are there any recommended approaches, best practices? Hopefully, I wrote it clear here.
Update 2: I am wondering about best practices here (links, example) not to start creating all this (points 2+3) from scratch. Are there any frameworks incapsulating this or good tutorials?
#Stanislaw - We have implemented the functionality you describe in an app called PreventConnect for one of our clients. The client already had some data stored out in a Google Fusion table. We extended their existing solution by adding another Google Fusion table which stores the geocoordinates for a number of locations. All this being said, to answer your questions...
1) The map portion itself is pretty out of the box, the tiles and what not, but you'll need to do some coding to get zoom extents, pin drops, annotations, and things like that working the way you expect them to work.
2) We found the Google Fusion solution to be quite effective. If you don't want to use Google Fusion there are other cloud database providers like StackMob, database.com, and many others. Google is free and they have an iOS SDK that makes communicating with Google Fusion pretty simple.
3) Absolutely! We cache much of the data in a Core Data store locally on the device. This greatly improves performance and responsiveness.
Time to write a solid answer to this my question (I could have it written a year ago but somehow I lost it from my mind).
Does MapKit has tiles functionality (Google Maps way) out-of-the-box and do I need to work on it additionally, if not?
The answer is yes: MapKit does have it. The keywords here are overlays (MKOverlay, MKOverlayView and others). See my another answer.
See also:
WWDC 2010 Session: Customizing Maps with Overlays,
Apple-WWDC10-TileMap.
What is the best practice of retrieving places information (markers positions and annotations) from server?
Actually since then I didn't learn a lot about "best practices" - unfortunately, nobody told me about them :( - that is why I will describe "my practices".
First of all, there are two strategies of populating a MapKit map with places:
The first strategy is about populating your map with the places by demand: imagine you want to display and see all places nearby (for example, no more than 1km from current user location) - this approach assumes that you ask your server only the places for the box you are being interested in. It means something like: "if I am in Berlin (and I expect 200 places for Berlin), why should I ever fetch the places from Russia, Japan, ... (10000+ places)".
This approach leads to relying on "tiles" functionality that question N1 address: Google maps and Apple maps are usually drawn using 'tiles' so for your "Berlin" portion of map you rely on corresponding "Berlin" tiles that are drawn by MKMapView - you use their dimensions, to ask your server only the places within the "Berlin" box (see my linked answer and the demo app there).
Initially this was the approach I've used and my implementation worked perfectly but later I was pushed to use second approach (see below) because the problem of clustering appeared.
The second strategy is to fetch all the places at once (yeah, all this 10000+ or more) and use Core Data to fetch the places needed for the visible portions of map your are interested in.
Second approach means, that during the first run you send your server a request to fetch all places (I have about 2000 in my app). Important here is that you restrict the fields you fetch to only geo-ones that you really need for your map: id, latitude, longitude.
This 'fetch-all' fetch has a significant impact on my app's first start time (On "the oldest" iPhone 4, I have near 700ms for the whole Fetch + Parse-JSON-into-Core-Data process, and extensive benchmarks show me that it is Core Data and its inserts is a bottleneck) but then you have all the essential geo-info about your places on your device.
Note, that whatever strategy you use, you should do a process of fetching these geo-points efficiently:
Imagine Core Data entity Place which has the following fields structure (preudo-Objective-C code):
// Unique identificator
NSNumber *id,
// Geo info
NSNumber *latitude,
NSNumber *longitude,
// The rest "heavy" info
NSString *name,
NSString *shortDescription,
NSString *detailedDescription, etc
Fetching places efficiently means that you ask only your place records geo-data from your server to make the process of this mirroring as fast as possible.
See also this hot topic: Improve process of mirroring server database to a client database via JSON?.
The clustering problem is out of scope of this question but is still very relevant and affects the whole algorithm you use for the whole proces - the only note I will leave here is that all the current existing clustering solutions will require you to use second strategy - you must have all the places prepared before you run into the clustering algorithms that will organize your places on a map - it means that if you decide to use clustering you must use strategy #2.
Relevant links on clustering:
WWDC 2011 Session: Visualizing Information Geographically with MapKit,
How To Efficiently Display Large Amounts of Data on iOS Maps,
kingpin - Open-source clustering solution: performant and easy-to-use.
Is it possible to cache this information so an user can see the nearby places of "his city" in offline mode?
Yes, both strategies do this: the first one caches the places you see on your map - if you observed Berlin's portion of map you will have Berlin part cached...
When using the second strategy: you will have all essential geo-information about your places cached and ready to be drawn on a map in offline mode (assuming that MapKit cached the map images of regions you browse in offline mode).

Is the Map Rails Kit worth the money?

http://railskits.com/map/
Would you like to launch your own
google map mashup? Need a way to
easily get data onto a map, but don’t
want to have to dig through piles of
poorly documented Google Maps
javascript code?
The Map Rails Kit allows you to deploy
a map mashup instantly. It extracts
all the Google Maps implementation
details, organizes all the
customizations into an easy to use
config file, and reimplements the map
controls, bubbles, and markers so your
app looks unique.
Populating your map with markers
consists of working with a few simple
ActiveRecord models so it’s amazingly
easy to get started. Create marker
records with titles, bubble content,
and location. If you specify just an
address to your markers, your markers
will be automatically geocoded for
you. You can even add tens of
thousands of markers to your maps
easily, and they’ll dynamically load
onto the map only when they are
currently in view as your users
navigate the map.
The Kit includes all the usability
polish that your users would expect in
a commercial map mashup. Their current
map settings are always saved via
session so when they come back to the
page later on, they’re right where
they left off before. For new
visitors, we support hooking into an
ip2location service in order to
initialize their current position. So
they immediately see their current
spot on the map, and can begin
interacting with it.
This Kit was authored by Jacques
Crocker.
This is kind of subjective, but I don't find the Google Maps API nearly as daunting as the blurb makes it out to be. I don't think I'd pay half a grand for an API to the Maps API — especially since you can buy a whole book on the topic for like $15 even if you find Google's docs lacking.
This guy doesn't even make it clear what it is he's selling. He makes the features of using the google maps API with Rails sound more difficult than entire feature set of Google maps itself.
There are plenty of other plugins and/or gems available that do more or less the same thing with slightly more effort involved and the book of course (possibly more than one at this point).
If you want a turnkey solution for stacks of money, .NET or some more commercial platform will have more options. I would avoid using this guys solutions out of selfishness, if he does well they'll be others with more colorful marketing making such grand solutions. After which Google will be clogged with them and we'll have to wade through dozens of such spectacular offerings to find the better, albeit less polished (less advertised) open source versions.
Are there any good googlemaps plugins for rails?

Resources