Dave,
Thank you for this post. Your description of how to handle date
ranges led me to a solution on the map lat/long issue that has gotten
so much discussion in various threads. I've posted the following in a
couple of other threads as well, since it seems to be a real issue.
But the solution is redundant properties, as you indicate. Basically,
the idea is finding a way to tokenize a region so that an infinite
number of points becomes a block...
What I do is that I break down the grid into sub-degree squares by
truncating after the first decimal point, and then when I save
something that I need to find on the map later, I save metadata with
that point indicating the surrounding grid squares.
So if I have a point with long -122.123123123 and lat 35.56565, that's
in a grid square called -122.1x35.5, and it's surrounded as follows:
[-122.2x35.6][-122.1x35.6][-122.0x35.6]
[-122.2x35.5][-122.1x35.5][-122.0x35.5]
[-122.2x35.4][-122.1x35.4][-122.0x35.4]
Those are all represented in my object as a list
(db.StringListProperty, so you have to do the right permutations to
make them into strings), and because of the way lists work, if a point
that you're searching on is in any of the grid squares associated with
a saved point, that saved point will come up.
To wit, if you have saved that above point, and someone comes in
searching on an address that corresponds to:
LONG -122.0857
LAT 35.69999
that corresponds to grid square '-122.0x35.6', which is in your upper
right hand corner. Thus, if your code is something like...
square = '-122.0x35.6' # based on whatever normalizing function
you use
points = (SELECT * FROM Locations WHERE gridList=:1", square)
...you'll find that the original point we saved above will return. Of
course, this is a simple example. Each grid square can be any size
and shape, and you can cluster as many as you like in whatever shape
you like. For me, a 3x3 grid of 0.1 degree squares is good enough.
0.1 degrees is approximately 7 miles in the north/south direction, and
up to that big in the east-west dimension, at least at the equator.
It's a blunt tool, but once I've got a reasonable set of map data
back, then I can do further operations to throw out what I don't need.
It's all about metadata. Don't think in terms of inequalities and
boundary conditions, think in terms of inclusive ranges. With a
little creativity, you don't need inequalities, at least for this
problem.
Best,
Ben
On Sep 7, 7:37 am, "David Symonds" <
dsymo...@gmail.com> wrote: