Look at GeoCouch, geohashing or use Solr as an external indexing service that 
also supports geohashes. While these are made for Earthly coordinates, I don't 
see a reason why it couldn't work for your purposes.

You could adapt a simple geohashing algorithm for your own problem which would 
result in the kind of index you can query.

GeoCouch:
https://github.com/vmx/couchdb (geocouch fork - Couchbase releases include the 
functionality)
http://vmx.cx/cgi-bin/blog/index.cgi/geocouch-geospatial-queries-with-couchdb:2008-10-26:en,CouchDB,Python,geo
http://2010.foss4g.org/presentations/3048.pdf

Geohashing:
http://geohash.org

Spatial Lucene & Solr:
http://blog.jteam.nl/2009/08/03/geo-location-search-with-solr-and-lucene/

Good luck and if you have concrete questions, shoot!

Gabor

On Mar 31, 2011, at 5:19 PM, Nebu Pookins wrote:

> On Tue, Mar 29, 2011 at 1:06 PM, Gabor Ratky
> <[email protected]> wrote:
>> you can always come up with 'smart' complex keys where the data you need 
>> ends up together, one query away.
> 
> What would the smart key be for this scenario?
> 
> Your documents have represent entities on an infinite 2D field, and
> each document has an attribute representing their X and Y coordinates,
> among other things.
> 
> You wish to find only the entities that are within the rectilinear
> rectangle defined by the top left corner (x1,y1) and bottom-right
> corner (x2,y2); or equivalently by its top-left corner and its width
> and height.
> 
> I've been trying to think of a mapping of the points on a 2D plane to
> a 1D line, that would map the opposite corners of the rectangle as
> opposite endpoints of a line, but I haven't been able to find any such
> mapping that works for arbitrary coordinates of the rectangle.
> 
> - Nebu

Reply via email to