4

I am working on a mobile mapping application (currently iOS, eventually Android) - and I am struggling with how to best support reverse geocoding from lat/long to Country/State without using an online service.

Apple's reverse GeoCoding API depends on Google as the backend, and works great while connected. I could achieve similar functionality using the Open Street Maps project too.

What I really want however is to create a C library that I can call even when offline from within my application, passing in the GPS coordinates, and having it return the country and/or state at those coordinates.

I've seen examples of how to do this on a server, but never anything appropriate for a mobile device.

What are some techniques to accomplish this?

4 Answers 4

3

I've answered to that kind of question there: https://stackoverflow.com/questions/4373730/is-there-an-offline-geocoding-framework-library-or-database-for-ios/4419113#4419113

The compilation of spatialite under iOS is not that easy. I struggled for a while before having something that works OK.

I have made a pdf file that explains the steps required to compile spatialite (+GEOS and PROJ4 that are required to get spatial indexes working properly with spatialite), I made the compilation of the whole stuff under XCode.

If you're interested in such PDF, just tell me, I can send it to you.

4
  • I'm absolutely interested - I'd hate to bang my head against a wall that you've already banged down. Thanks!
    – radven
    Jan 6, 2011 at 19:03
  • Hi Radven, I've sent you an email at the email I've got at this page : technomadia.com/about-us (great picture actually ;)
    – yonel
    Jan 7, 2011 at 10:43
  • 1
    Hi, I've improved the build of static libraries for spatialite so that the integration of it in XCode gets a lot easier . More info there : stackoverflow.com/questions/4793970/…
    – yonel
    Feb 1, 2011 at 14:36
  • Hi @yonel, I'm new so please bear with me. I read all your answers.Can you please share the pdf with me([email protected])..Or any better solution you found so far? can you guide me ?
    – nadeem gc
    Nov 26, 2014 at 18:40
3

I would look into using Spatialite. It's sqlite + spatial functions and indexes. It'll do what you need and should(?) work on iOS.

See also: Reverse Geocoding Without Web Access

2

In addition to spatialite you could also use a raster approach. Simply convert the vector to a sensible resolution, and include a lookup table for attributes in your code. It will not be terribly accurate close to boundaries but should be very fast if you get the correct formats and compression.

0

Most solutions answered here need some libs for spatial functions (R-Tree and etc). There is a simple solution that does not need libs at all to do reverse geocoding. I have answered this in another question (https://stackoverflow.com/a/73027520/17219971).

The solution is based on run-length-encoding and is very simple to use. You could put the data into a regular SQLite DB and the query is efficient. See the linked answer to learn how this works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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