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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:14:02+00:00 2026-05-31T14:14:02+00:00

I have a SQLite database in Android with a table that contains longitude, latitude

  • 0

I have a SQLite database in Android with a table that contains longitude, latitude and other columns.. now I want to get all records that have the distance smaller or equal to a given distance.

For example, I know my current coordinates(lat,long) and I want to get from my table all records that are at the maximum distance of 10km from me.

I found some links on stack but nothing too solid. Is there someone that knows an optimized solution for this problem?

I have thought that I could get all records that have latitude smaller than my lat + distance and greater than my lat – distance and longitude smaller than my long + distance and greater than long – distance. After this query I should check for some unwanted records since the query is not returning only the wanted records..
Is this a good idea?

  • 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-31T14:14:03+00:00Added an answer on May 31, 2026 at 2:14 pm

    You probably want to do this in two parts,

    1) Run a query where you find all records that are within a certain value + or – of the current lat/lng of your location, the where clause might look like:

    where (@latitude > (lat – .001) and @latitude > (lat – .001)) and
    (@longitude> (lng- .001) and @longitude> (longitude- .001))

    2) with the rough results from above, use the great circle/haversine method to determine what the actual distance between each location is (great circle/haversinse is already part of the android maps api).

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

Sidebar

Related Questions

I have one problem with Android SQLite database. I have one table which contains
I have a SQLite database that contains a huge set of log messages. I
I have a DataTable which I want to save to a SQLite Database Table.
I have a component that i want to store to an SQLite database. public
I have a database name "CUED" (sqlite Android)it have a table HELLO which contain
I have written an Android application that uses SQLite database which is saved in
I have a datalogging application (c#/.net) that logs data to a SQLite database. This
I have a SQLite database, and several tables within that datbase. I am developing
I have created an application in Android that needs to send emails to all
This is about Android and SQLite database. Simply, I want to know, how can

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.