Offline rendering - routing in external app by using Osmand

416 views
Skip to first unread message

Arman Safikhani

unread,
Jul 21, 2014, 6:42:31 AM7/21/14
to osm...@googlegroups.com
Hello,
 
I am developing a phonegap map and navigation application and I need to have offline tile rendering (from osm map files) and routing - navigation stuff.
 
I currently developed an initial app which uses mapsforge rendering engine to render the tiles ( You can check the repository here : https://github.com/Arman92/Mapsforge-Phonegap-OfflineCache)
 
Unfortunately mapsforge does not offer much functionalities.
I found Osmand a lot more mature with a lot more features.
 
The problem is, Osmdroid comes with very complex structure with no documentation on how to use the API.
 
In my particular case, I need to use Osmand internal classes to achieve offline tile rendering and offline routing and navigation.
 
Just for clarification, My phonegap application calls some plugin to return desired bitmap tile with x, y and parameters or requesting a route with start and end locations as parameters.

Is there anyway to do that?

Arman Safikhani

unread,
Jul 22, 2014, 1:46:21 AM7/22/14
to osm...@googlegroups.com
I'm a in a hurry and I need some answer as soon as possible..

Please light me up wheter what I want to do is possible.

John T

unread,
Jul 22, 2014, 10:49:42 AM7/22/14
to osm...@googlegroups.com
You're going to have a hard time. I can't offer you any documentation for how Osmand renders the map or creates routes, it's something you'll have to investigate for yourself. In my experience it takes a while to wrap your head around. Please also take notice that mapsforge, Osmand, and Osmdroid are all very different things. (And I would suggest using Mapbox's fork of Osmdroid rather than Osmdroid itself- it's much better supported.)

Osmand uses OBF files (a custom format different from other OSM data) so I doubt mapsforge will be able to read them. Osmand has no capability to render real bitmap files- the rendered data is passed directly to the screen.

For requesting a route with given start and end points, you might have a little more success. AFAIK, Osmand saves a GPX file to a folder on the SD card after calculating a route. If you can parse GPX files in your application, you should be able to make something work. However, there are online routing engines that are easier to work with- if your app does not require offline use, I'd use a web service.

If you can justify taking up a lot of storage space, why not use a map tile service for getting your bitmaps? This can be done in online or offline mode. (Offline means pre-downloading all the tiles while online- hence the storage requirements.) There's a plugin for this in Osmand already, you could possibly copy the code. (Just be aware of licensing.) 

It seems like you're trying to do something rather hard, and doing so in the most inconvenient way possible. Unless you have very strict requirements (you must use phonegap, you must not use the Osmand source code, etc.) I would re-consider the way you're attacking this problem.

Arman Safikhani

unread,
Jul 22, 2014, 11:09:42 AM7/22/14
to osm...@googlegroups.com

First of all, thanks for your reply.
I thought that Osmand is capable of generating real bitmap tiles from its own obf files, so I decided to change my tile renderer from mapsforge to osmand in order to have all the functionalities in one library (e.g. routing, navigation, tile rendering,.. )

Generating GPX file and re-parsing it might be a time consuming procces.
The application must work entirely offline so there is no chance of using online services. that's what makes it more complex.

I already have used the Cartotype Android Library for routing, geocoding and reverse geocoding.
It's a great library, too. but it's native code and the native c++ is not open source.

And of course stroring the whole country as tile bitmaps on phones storage is not a good idea as it might grow up to 2.5GB.

I wish I could do it the easy way, but the application requirements makes me to go through the hard one (phonegap)!!

Ok, in a nutshell, as I myself figured out, there is no easy way to use osmand as a third party library to empower our application with Routing, Navigation, GeoCoding and Reverse GeoCoding, but it is possible after all.

Thank you for your assistance,
I will consider your guidance and make a final decision!

Arman Safikhani

unread,
Jul 23, 2014, 3:37:24 AM7/23/14
to osm...@googlegroups.com
Does MapBox Android fork of osmdroid support offline GeoCoding, Routing and Navigation?




On Monday, July 21, 2014 3:12:31 PM UTC+4:30, Arman Safikhani wrote:

John T

unread,
Jul 23, 2014, 5:45:11 PM7/23/14
to osm...@googlegroups.com
No.
Reply all
Reply to author
Forward
0 new messages