here's an interesting bit of a post from this very group that never
got answer almost a year ago. I've decided to 'bump it', so to speak,
as I judge these kinds of issues seem to have just been "swept under
the rug" every time someone cared to ask about it:
from 'john', on May 28th, 2008:
Hello,
GeoPt is a data type supported by the datastore. I want to query
it.
My first attempt is
class TestHandler(webapp.RequestHandler):
def get(self):
self.response.out.write("Since GeoPt is a data type for the
datastore, can a GAE datastore query be used for a bounding box geo
query? <br/>")
loc1=db.GeoPt(25.1, -125.757)
# loc2=db.GeoPt(49.5,
-69.56)
loc2=db.GeoPt(49.5, -90)
q = kerncomputing.historicplace.HistoricPlace.all()
q.filter("loc > " , loc1 )
q.filter("loc < " , loc2 )
results = q.fetch(20)
i=1
for p in results:
self.response.out.write("%d) name = %s ( " %
(i,p.displayName))
self.response.out.write(p.loc)
self.response.out.write(")<br/>")
i += 1
loc1 and the version of loc2 which is commented out are a bounding
box
of the continently USA. If you run that query, all 11 points are
returned as they should be. If you invert the less than and
greater
than operations, the result is empty. So far, so good.
Now consider when loc2 is loc2=db.GeoPt(49.5, -90). I would
expect
all locations on the east coast to be omitted from the results but
all
are listed. Here is the surprising output with GeoPt's.
1) name = Sutter's Fort ( 38.572222,-121.470833)
2) name = Boyd Theatre ( 39.951836,-75.167068)
3) name = Charity Hospital and the Adjacent Neighborhood
( 29.955595,-90.0771)
4) name = Great Falls Portage ( 47.503611,-111.286389)
5) name = Streetwall ( 41.884529,-87.624485)
6) name = Statler Hotel ( 32.77993,-96.795379)
7) name = Hanger One, Moffet Field ( 37.415,-122.048333)
8) name = Peace Bridge Neighborhood ( 42.90694,-78.90556)
9) name = The Lower East Side ( 40.7196006775,-73.989402771)
10) name = Sumner Elementary School ( 39.058056,-95.682222)
11) name = Vizcaya and Bonnet House ( 25.743611,-80.210278)
Do you see an error or erroneous assumption in my code? Or pointer
to
an example of a bounding box geo query via the datastore would do
the
trick.
Thanks for your time and consideration,
Sincerely,
John
anyone ?? .........
On Mar 24, 12:07 am, lock <[email protected]> wrote:
> You can do equality type checks, but that's about it :-( .
>
> A quick search of this group for geohash should point you in
> the right direction though.
>
> On Mar 24, 10:41 am, pedepy <[email protected]> wrote:
>
>
>
> > I just watched that talk about geo data on youtube (i think it was
> > from google IO?)... and it made me really think ... what queries can
> > be performed on geopt properties, if any ?
>
> > are any kinds of spatial query features planned for gql and the
> > datastore? .... it seems that right now, these properties are of no
> > worth whatsoever ... other than many saving us from writing 5 or 6
> > lines of code to define them ourselves.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---