2

I have been going through trying to find the best option on Google App Engine to search a Model by GPS coordinates. There seem to be a few decent options out there such as GeoModel (which is out of date) but the new Search API seems to be the most current and gives a good bit of functionality. This of course comes at the possibility of it getting expensive after 1000 searches once this leaves the experimental zone.

I am having trouble going through the docs and creating a coherent full example to be able to use the Search API to search by location and I want to know if anyone has examples they are willing to share or create to help make this process a little more straightforward. I understand how to create the actual geosearch query but I am unclear as to how to glue that together with the construction and indexing of the document.

clifgray
  • 4,313
  • 11
  • 67
  • 116

1 Answers1

1

I don't know of any examples that show geo specifically, but the process is very much the same. You can index documents containing GeoFields, each of which has a latitude and a longitude. Then, when you construct your query, you can:

  • limit the results by distance from a fixed point by using a query like distance(my_geo_field, geopoint(41, 65)) < 100
  • sort by distance from a point with a sort expression like distance(my_geo_field, geopoint(55, -20))
  • calculate expressions based on the distance between points by using a FieldExpression like distance(my_geo_field, geopoint(10, -30))

They work pretty much like any other field, except you can use the distance function in the query and expression languages. If you have any specific questions, feel free to ask here.

Haldean Brown
  • 12,411
  • 5
  • 43
  • 58
  • were you able to get geo queries working on the development server? They don't seem to work there... – flynn May 10 '13 at 21:25
  • @Will Brown, please what is the unit of the "100" in that query expression? Is it in miles, kilometers, meters? – Sayo Oladeji Oct 04 '13 at 10:58