Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8676669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:15:19+00:00 2026-06-12T20:15:19+00:00

I am building an application on google app engine with python and I have

  • 0

I am building an application on google app engine with python and I have a Location entity that has a GPS property. This property is stored as a string (though I could change this if need be) and I want to let the user type in a location and have my program return all the sites within 5 points of latitude or longitude.

I have the following code which gives me the location in GPS that the user is searching for but I am not sure what I can do from there and how I can do a query for all the GPS locations within my bounds.

class Map(BlogHandler):
    def get(self):
        #do some stuff here
    def post(self):
        inputlocation = self.request.get("q")

        #this returns the GPS location that the user searched for
        g = geocoders.Google()
        place, (lat, lng) = g.geocode(inputlocation)

        #I would like to be able to do something like this         
        bound = 5
        upper = GPSlocation + bound
        lower = GPSlocation - bound
        left = GPSlocation + bound
        right = GPSlocation - bound

locations = db.GqlQuery("select * from Location where GPSlocation.lat<:1 and where GPSlocation.lat>:2 and where GPSlocation.long <:3 and where GPSlocation.long >:4 order by created desc limit 20", upper, lower, left, right)

        self.render('map.html', locations=locations, centerlocation=GPSlocation)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:15:20+00:00Added an answer on June 12, 2026 at 8:15 pm

    searching by 5 points is pretty easy, since that’s just a square area:

    select ...
    where (GPSlocation.lat BETWEEN (:1 - 5) AND (:2 + 5))
       and (GPSlocation.long BETWEEN (:3 - 5) AND (:4 + 5))
    

    if you were targeting a circular boundary, then you’d be in for a bit more math.

    note that your where condition in your own query is invalid and will cause a syntax error. WHERE syntax is

    WHERE (condition) AND (condition) ...
    

    not

    WHERE (condition) AND WHERE (condition) ...
                          ^^^^^---syntax error
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a multiuser realtime application with Google App Engine (Python) that would look
I am building an application with Python 2.7 using the Google App Engine framework.
I am building a web application on Google App Engine that requires users to
I am building a web application on google app engine using python and jinja2.
I'm building an application using Google app engine with python, and I'm stuck with
I'm currently building a Python webapp on the Google App Engine and I want
We are building an application on Google App Engine in Java using Spring 2.5.
I'm building an application using Google App Engine. The application consists of several servlets,
I'm building an web app that uses this code to search for addresses: http://code.google.com/intl/en/apis/maps/documentation/javascript/examples/places-autocomplete.html
I am building an application for Facebook using Google App Engine. I was trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.