Hello everyone, 

I'm working on a application that uses Cassandra and has a geolocation 
component.
I was wondering beside the slides and video at 
http://www.readwriteweb.com/cloud/2011/02/video-simplegeo-cassandra.php that 
simplegeo published regarding their strategy if anyone has implemented geohash 
storage and search in cassandra.
The basic usage is to allow a user to find things close to a geo location based 
on distance radius.

I though about a couple of approaches.

1. Have the geohashes be the keys using the Ordered partitioner and get a group 
of rows between keys then store the items as columns in what it would end up 
looking like wide rows since each column would point to another row in a 
different column family representing the item nearby.

2. Simply store the geohash prefixes as columns and use secondary indexes to do 
queries such as >= and <=. 

The problem I'm facing in both cases is ordering by distance and searching 
neighbors. 

The neighbors problem is clearly explained here: 
https://github.com/davetroy/geohash-js

Once the neighbors are calculated an item can be fetched with SQL similar to 
this.

SELECT * FROM table WHERE LEFT(geohash,6) IN ('dqcjqc', 
'dqcjqf','dqcjqb','dqcjr1','dqcjq9','dqcjqd','dqcjr4','dqcjr0','dqcjq8')

Since Cassandra does not currently support OR or a IN statement with elements 
that are not keys I'm not sure what the best way to implement geohashes may be.

Thanks in advance for any tips.

Reply via email to