Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 4720 invoked from network); 17 Apr 2010 12:31:51 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Apr 2010 12:31:51 -0000 Received: (qmail 31548 invoked by uid 500); 17 Apr 2010 12:31:50 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 31515 invoked by uid 500); 17 Apr 2010 12:31:50 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 31507 invoked by uid 99); 17 Apr 2010 12:31:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Apr 2010 12:31:50 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mason@onespot.com designates 209.85.211.195 as permitted sender) Received: from [209.85.211.195] (HELO mail-yw0-f195.google.com) (209.85.211.195) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Apr 2010 12:31:45 +0000 Received: by ywh33 with SMTP id 33so2331332ywh.11 for ; Sat, 17 Apr 2010 05:31:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.90.106.19 with HTTP; Sat, 17 Apr 2010 05:31:24 -0700 (PDT) In-Reply-To: References: Date: Sat, 17 Apr 2010 07:31:24 -0500 Received: by 10.90.38.13 with SMTP id l13mr1615578agl.119.1271507484344; Sat, 17 Apr 2010 05:31:24 -0700 (PDT) Message-ID: Subject: How to model 2D data in Cassandra? From: Mason Hale To: "user@cassandra.apache.org" Content-Type: text/plain; charset=ISO-8859-1 On Saturday, April 17, 2010, philip andrew wrote: > Hi, > Lets say I wanted to store 2 dimensional data in the database, each object has a X and Y location in a very large space. > I want to query Cassandra for all objects within a rectangle. > You should look into Geohash (http://en.m.wikipedia.org/wiki/Geohash) or one of the similar alternatives. They map geographic coordinates to lexigraphically sortable identifiers which can be used to find all entities in a geographic region or to test whether two entities are in the same region by comparing a single key per entity. No geometry calulations required. ;-) This page provides a good description of the technique: http://code.google.com/apis/maps/articles/geospatial.html Mason -- Mason Hale http://www.onespot.com direct +1 800.618.0768 ext 701