From time to time one might feel the urgent need to execute geospatial queries on the Google AppEngine. Thinking in common SQL this is pretty easy, just a combined WHERE clause:
SELECT * FROM t_spatialdata WHERE latitude >= south AND latitude <= north AND longitude >= west AND longitude <= east
So this problem can basically be solved, by using a algorithm called Geohash, which unfortunately didn't want to return proper results, at least not the implementations I found. (The 'official' implementation uses the BitSet-Class which is not present when using AppEngine/GWT)
The solution I went for is the "javageomodel"-project which follows (afaik) a similar algorithm but worked. http://code.google.com/p/javageomodel/
The problem you will face, when trying to use this in your AppEngine project is that it will be missing (just at runtime!) two classes from the Apache Commons project: StringUtils and Validator. At least the latter one is over 1MByte in size. So I decided to replace the Validator lines with standard "assert"-calls, but adding the jars probably would have worked too.
For your convenience I uploaded the final jar that works fine:
http://rapidshare.com/files/393375528/libjavageomodel.jar.htmlA how to use this for actual queries is located here:
http://code.google.com/p/javageomodel/source/browse/trunk/geocell/src/test/java/com/beoui/utils/HowToUseGeocell.java
Hi Nicolas
AntwortenLöschenIs Geohash more efficient than the simple query you showed at the top, or is it just useful as a workaround, as you described for AppEngine?
Regards
Neil
Does the Javageomodel Proximity search work. It seems the geocells and geocellsp values are switched in the geocellmanager
AntwortenLöschenHello guys, just posted a javageomodel with objectify, decoupled from JPA/JDO http://brunofuster.wordpress.com/2010/09/21/javageomodel-with-objectify/
AntwortenLöschen