[ https://issues.apache.org/jira/browse/LUCENE4922?page=com.atlassian.jira.plugin.system.issuetabpanels:commenttabpanel&focusedCommentId=13652785#comment13652785
]
John Berryman edited comment on LUCENE4922 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 1by1 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],depth1)
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 1by1 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],depth1)
}}
> A SpatialPrefixTree based on the Hilbert Curve and variable grid sizes
> 
>
> Key: LUCENE4922
> URL: https://issues.apache.org/jira/browse/LUCENE4922
> Project: Lucene  Core
> Issue Type: New Feature
> Components: modules/spatial
> Reporter: David Smiley
> Assignee: David Smiley
> Labels: gsoc2013, mentor, newdev
>
> My wishlist 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 inbetween)
> * Compact binary encoding (socalled "Morton number")
> * Works for geodetic (i.e. lat & lon) and nongeodetic
> Some bonus wishes for use in geospatial:
> * Use an equalarea 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 superskinny 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, email: devunsubscribe@lucene.apache.org
For additional commands, email: devhelp@lucene.apache.org
