Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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)

share|improve this question
    
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) –  thyandrecardoso Aug 19 '11 at 8:27
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
    
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... –  George Aug 19 '11 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 Aug 19 '11 at 15:19
    
Seems an acceptable way to do this... seems a good a idea, if nothing really oriented to PostGIS works on Android. –  thyandrecardoso Aug 19 '11 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 Aug 22 '11 at 13:30
    
Yup, did not think about that... –  thyandrecardoso Aug 22 '11 at 16:12
add comment

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

*Still in development and not all functions work

http://www.bernawebdesign.ch/byteblog/2011/08/17/qgis-on-android/

Do not think there is an option to avoid PostGIS SQL

share|improve this answer
    
I'm not really looking for an application, but rather a object-relational mapping software. –  thyandrecardoso Aug 19 '11 at 8:41
    
This doesn't provide an ORM for PostGIS. –  Sean Aug 19 '11 at 15:31
    
This stackexchange post has stackoverflow.com/questions/371538/… –  Mapperz Aug 19 '11 at 15:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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