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 8040125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:47:36+00:00 2026-06-05T03:47:36+00:00

I have a django based web app which stores locations. I have an android

  • 0

I have a django based web app which stores locations.

I have an android mobile app which pulls the locations from the web app and saves locations to the web app. The locations returned back to me I load on a mapoverlay in my app.

I would like to send my current coordinates and return a list of locations which are within a certain range. For example I send my location and get back items within a radius of 2km. (Similar to how the Google Places API works, just searching my data).

It is probably best to send the location coordinates and do all this logic in my python django app, Then return a list of correct locations and just display the places on my map.

I don’t know where to begin doing this.
How can I filter out my stored locations within certain radius(km) based off a given set of coordinates?

  • 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-05T03:47:38+00:00Added an answer on June 5, 2026 at 3:47 am

    Haversine Equation is the answer to your question. However it is slightly difficult to decrypt so here I provide you with a simple explanation:

    To put it simply:

    Here’s the sample/example SQL statement that will find the closest 20 locations that are within a radius of 25 miles to the 37, -122 coordinate. It calculates the distance based on the latitude/longitude of that row and the target latitude/longitude (given by lat/lng in the equation below), and then asks for only rows where the distance value is less than 25, orders the whole query by distance, and limits it to 20 results. To search by kilometers instead of miles, replace 3959 with 6371.

    SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 25 ORDER BY distance LIMIT 0 , 20;
    

    You can convert the sql to anything you desire. I mean the principle remains the same.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a URL in a Django based web app that looks similar to
We have a web based application in production built using django. It is deployed
I have a Django-based web application that is required to send a confirmation email
In our web application (django based, with solr backend) we have some checkboxes with
I have a django-based web application that is a mixture of jQuery and several
I have a text area in a django based website that displays the content
I have a Django form that uses a different number of fields based on
I have django form and I am receiving from POST a date formated like
I have django model which consist of parent child relationship filed I want to
I am trying to install Fan-of-Mongo a web admin for MongoDB which is based

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.