You could filter out a square region of a reasonable distance from the
iPhone in the query and then sort the positions in your application
and finally remove positions from the bottom of the list if there are
too many. Do keep in mind that you have to adjust the longitude range
as you get closer to the poles, because one degree longitude close to
the poles is much longer in distance than it is at the equator.

I'm not sure how the datastore handles floating point filtering. It
might be wiser to make integer fields with the positions multiplied by
a factor.

You'll also need to solve the "wrap-around" problem that occurs at
0/90 degrees.

Regards,
Andreas

On Jan 29, 7:15 pm, arnie <parvez...@rediffmail.com> wrote:
> Hi all
> I have to design a wsgi app which is returning xml data to be consumed
> by an iphone application. The iphone app sends an http request with
> latitude and longitude from iphone. Based on these entries, I need to
> query datastore table. The datastore table itself also contains
> latitude and longitude values in each row. I need to apply a distance
> calculation formula on this based on latitude and longitude values.
> Then I need to sort them in ascending order of distance. My problem is
> that we cannot reach at the final result before completing the
> calculation and also I do not want to send large xml data to iphone
> application to consume. Earlier I think to divide the process in two
> phases
> Phase 1: Does the calculation in wsgi application and generates the
> entire xml and sent the same to iphone
> PHase 2: iphone app sort the xml into ascending order
> But it will result in performance issue both at iphone and wsig
> application end. So is there any alternative that may give us limited
> data and that too sorted so that iphone can ask for another slot with
> no performance issue
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to