Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 51E0211259 for ; Thu, 9 May 2013 07:01:25 +0000 (UTC) Received: (qmail 32036 invoked by uid 500); 9 May 2013 07:01:23 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 31067 invoked by uid 500); 9 May 2013 07:01:22 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 31054 invoked by uid 99); 9 May 2013 07:01:21 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 May 2013 07:01:21 +0000 Date: Thu, 9 May 2013 07:01:21 +0000 (UTC) From: "John Berryman (JIRA)" To: dev@lucene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (LUCENE-4922) A SpatialPrefixTree based on the Hilbert Curve and variable grid sizes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LUCENE-4922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13652785#comment-13652785 ] John Berryman edited comment on LUCENE-4922 at 5/9/13 7:00 AM: --------------------------------------------------------------- {{# Converts from an x,y coordinate (vals[0],vals[1]) between min and max values to a point on the Hilbert curve in base4}} # def hilbert_point(vals,depth,mins=[],maxs=[]): """ cell_names 3 2 0 1 """ if(mins): # then convert vals to some place in 1-by-1 grid at the origin vals[0] = (vals[0]-mins[0])/(maxs[0]-mins[0]) vals[1] = (vals[1]-mins[1])/(maxs[1]-mins[1]) if(depth == 0): return '' if( vals[0]<=0.5 and vals[1]<=0.5 ): cell_name = '0' x = vals[1]*2 y = vals[0]*2 elif( vals[0]>=0.5 and vals[1]<=0.5 ): cell_name = '1' x = (vals[0] - 0.5)*2 y = vals[1]*2 elif( vals[0]>=0.5 and vals[1]>=0.5 ): cell_name = '2' x = (vals[0] - 0.5)*2 y = (vals[1] - 0.5)*2 elif( vals[0]<=0.5 and vals[1]>=0.5 ): cell_name = '3' x = 1 - (vals[1] - 0.5)*2 y = 1 - vals[0]*2 return cell_name + hilbert_point([x,y],depth-1) was (Author: berryman): {{ # Converts from an x,y coordinate (vals[0],vals[1]) between min and max values to a point on the Hilbert curve in base4 # def hilbert_point(vals,depth,mins=[],maxs=[]): """ cell_names 3 2 0 1 """ if(mins): # then convert vals to some place in 1-by-1 grid at the origin vals[0] = (vals[0]-mins[0])/(maxs[0]-mins[0]) vals[1] = (vals[1]-mins[1])/(maxs[1]-mins[1]) if(depth == 0): return '' if( vals[0]<=0.5 and vals[1]<=0.5 ): cell_name = '0' x = vals[1]*2 y = vals[0]*2 elif( vals[0]>=0.5 and vals[1]<=0.5 ): cell_name = '1' x = (vals[0] - 0.5)*2 y = vals[1]*2 elif( vals[0]>=0.5 and vals[1]>=0.5 ): cell_name = '2' x = (vals[0] - 0.5)*2 y = (vals[1] - 0.5)*2 elif( vals[0]<=0.5 and vals[1]>=0.5 ): cell_name = '3' x = 1 - (vals[1] - 0.5)*2 y = 1 - vals[0]*2 return cell_name + hilbert_point([x,y],depth-1) }} > A SpatialPrefixTree based on the Hilbert Curve and variable grid sizes > ---------------------------------------------------------------------- > > Key: LUCENE-4922 > URL: https://issues.apache.org/jira/browse/LUCENE-4922 > Project: Lucene - Core > Issue Type: New Feature > Components: modules/spatial > Reporter: David Smiley > Assignee: David Smiley > Labels: gsoc2013, mentor, newdev > > My wish-list for an ideal SpatialPrefixTree has these properties: > * Hilbert Curve ordering > * Variable grid size per level (ex: 256 at the top, 64 at the bottom, 16 for all in-between) > * Compact binary encoding (so-called "Morton number") > * Works for geodetic (i.e. lat & lon) and non-geodetic > Some bonus wishes for use in geospatial: > * Use an equal-area projection such that each cell has an equal area to all others at the same level. > * When advancing a grid level, if a cell's width is less than half its height. then divide it as 4 vertically stacked instead of 2 by 2. The point is to avoid super-skinny cells which occurs towards the poles and degrades performance. > All of this requires some basic performance benchmarks to measure the effects of these characteristics. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org