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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:38:30+00:00 2026-05-19T00:38:30+00:00

Does django have anything that will look at a geographic coordinate (decimal lat/long) and

  • 0

Does django have anything that will look at a geographic coordinate (decimal lat/long) and determine if is inside a circle with a certain radius (let’s say 100 Km)?

I have certain type of data, each has a lat/long and I would like to make a search in the database to see if that data is located inside of a circle with a specified radius size.

I could probably write something myself that will handle this but I wander if there is something written already that will handle this.

  • 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-05-19T00:38:30+00:00Added an answer on May 19, 2026 at 12:38 am

    This problem can be solved in pure SQL if you dont mind about very good precision.

    You can find points around a GPS position with this specific SQL query :

    # find point around :
    latitude = 46.2037010192871
    longitude = 5.20353984832764
    query= "SELECT ID, NOM, LAT, LON, 3956 * 2 * ASIN(SQRT(POWER(SIN((%s - LAT) * 0.0174532925 / 2), 2) + COS(%s * 0.0174532925) * COS(LAT * 0.0174532925) * POWER(SIN((%s - LON) * 0.0174532925 / 2), 2) )) as distance from POI  having distance < 50 ORDER BY distance ASC " % ( latitude, latitude, longitude)
    

    This will give you all records with gps records in a 50km area.

    You can easily plug this in django with :

    from django.db import connection
    cursor = connection.cursor()
    cursor.execute( query )
    rows = cursor.fetchall()
    

    or with django raw queries

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

Sidebar

Related Questions

I have a Python program (with Django - does this matter?) that I want
Given that django-nonrel has got JOINs working, does this mean we have M2M fields
Does Rails 3 have anything akin to slices in Merb, or areas in Django
I have a django model and model form that look like this: -models.py class
I feel like I am writing something that should already exist. Does Django have
Does Django have anything equivalent to the New Relic RPM performance monitoring app for
I have a Django form that will add an entry to a database with
I am doing geolocation, and Django does not have a PointField. So, I am
django-userena does not have a views.py file. It uses instead html files, i would
Have you tried Psyco in a wsgi application (custom, Pylons, Django...)? What does your

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.