I'm working on a Android app which should manage data on a remote PostGIS database. Before diving into actual programming, I'm searching for ORMs for Android. I've found a couple, namely androrm and ormlite.

However, these don't seem to give me an interface to query objects by the geometry column. For example, find all objects within a radius from the current location... I'd need to write SQL for this...

What are my best options here?

Is there a way to completely avoid PostGIS SQL?

Or not really?

Thanks in advance.

(EDIT, 19/08/11: changed the title)

  • The new title, added by whuber, is probably deceiving. I'm not looking for an application or interface, but rather a programming object relational mapping layer. So I think I'll rewrite the title...(don't really know the 'protocol' on these situations, I'm a new user here) Commented Aug 19, 2011 at 8:27

2 Answers 2


The only ORM for PostGIS that I'm aware of is the one used in GeoDjango. If you can, move the spatial querying functionality to the server with GeoDjango on the backend and send HTTP queries from Android.

The Android app would send POST or GET requests with the parameter e.g. object id and a distance to search. The GeoDjango views would do all of the PostGIS query construction for you. A search for ZIP codes within 5km of a point (where 'geom' is the Point object) would look like:

Zipcode.objects.filter(poly__dwithin=(geom, D(km=5)))

No SQL to write. You can get the geometries back as GeoJSON, KML, EWKB, WKB, WKT, etc.

  • It depends on GEOS which i'm not sure it's avaliable for android. There was some efforts (along with the aforementioned) QGIS for android software to compile GEOS for it... Commented Aug 19, 2011 at 15:03
  • I didn't suggest running it on Android. I suggested running it on the server. He's accessing a remote PostGIS database. He can easily put GeoDjango on the server in between. Also, GEOS is not necessarily required if using PostGIS with GeoDjango.
    – Sean
    Commented Aug 19, 2011 at 15:19
  • Seems an acceptable way to do this... seems a good a idea, if nothing really oriented to PostGIS works on Android. Commented Aug 19, 2011 at 15:24
  • If this is a public app, you probably don't want the client hitting the database directly, anyhow. Having something like Django in between will make it more secure. An internal app might be a different story.
    – Sean
    Commented Aug 22, 2011 at 13:30
  • Yup, did not think about that... Commented Aug 22, 2011 at 16:12

Quantum GIS on an android (3.2) tablet (Asus transformer)

*Still in development and not all functions work


Do not think there is an option to avoid PostGIS SQL

  • I'm not really looking for an application, but rather a object-relational mapping software. Commented Aug 19, 2011 at 8:41
  • This doesn't provide an ORM for PostGIS.
    – Sean
    Commented Aug 19, 2011 at 15:31
  • This stackexchange post has stackoverflow.com/questions/371538/…
    – Mapperz
    Commented Aug 19, 2011 at 15:40

Your Answer

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

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