I am trying to develop an offline android map that makes use of OSM map tiles of 15 zoom level, For this purpose i used an open source library : Osmdroid

Now, i m looking into the possibility of creating an offline geocoding/ reverse geocoding that can be integrated with my application,

can i use Osm xml data for that purpose? if so , then can anyone suggest/explain how to use it to create SQlite db.. to be used wit my app

While doing this, i hope i m not violating any data usage terms or conditions?



Yes, you can use the OSM XML data. Unfortunately it's a 250GB XML file. Trying to get all that data onto a mobile device is very challenging.

I don't think SQLite is the right way to store the map data, you're going to need something more efficient (in terms of disk space efficiency). There is a format under development called OSM Mobile Binary Format, which may be suitable:

Essentially it breaks the world up into smallish chunks, and has some simple math to figure out which one you need for a given position in the world. You should be able to fit at least most of the world on a typical smartphone in this format.

That will cover reverse geocoding. But for geocoding you will need your data the other way around, perhaps an SQLite database containing street/city names with a single lat/long coordinate for each one. Once you have a lat/long, you can quickly search the OSM Mobile Binary files to find the rest of the metadata related to that entry.

You are required to provide your own mirror of the data for all the users of your app. You cannot write an app which downloads data directly from the openstreetmap servers. You will be blacklisted. This might mean you will need to sell your app for a nominal fee, to cover server costs.

In terms of licensing, it's creative commons/share alike. You need to give clear attribution to openstreetmap.org somewhere in your app, and any modifications to the map data must be released under the same or equivalent license (your actual app can be any license). See the OSM wiki for more specific details.

  • Thanks, and yes forgot to mention , i l be working on city based geocoding...so i need only few Mbs ? – android_hungry Jan 8 '12 at 9:32
  • In that case, yeah you will only need a few megs, depending on the size of the city. A 50MB XML file is ~1.5MB in the Mobile Binary format. And a typical ARM CPU is a bit slow at parsing XML compared to x86 however (a 1Ghz dual core ARM is slower than a single core 1Ghz Pentium 3), so it's still a good idea to consider a binary format. Only testing will tell you how slow SQLite is though. I suspect disk space may be an issue with SQLite, especially if you want indexes. – Abhi Beckert Jan 8 '12 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.