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

  • Home
  • SEARCH
  • 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 3492038
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:42:35+00:00 2026-05-18T11:42:35+00:00

I have in my android application a database table with geo pointes (lat and

  • 0

I have in my android application a database table with geo pointes (lat and lon are decimal degree values), about 1000 points. And I need to select 20 nearest point to some given geo point.

I’ve found at Stackoverflow the answer how to compute distance between two geo points and was very happy, till I tried to write my query. I’ve found out, that it’s not possible to use trignometrical functions in built-in sqlite of android.

But then I’ve got an Idea. I don’t really need to compute a distance. The near a point is to another one the smaller difference in their geo coordinates should be.

How could I use this fact? Would it be enough to order saved points by (lat_0 – lat_n)^2 + (lon0-lon_n)^2, where lat_0 and lon_0 are geo coordinates of a given point?

Thank you,

Mur

UPD

So, the best way to get an answer for my question was to test approach I describe above.

It works pretty well but not really exactly compared to exact distance.

So if you just need to compute a distance, this solution is ok, but in my case I also needed to order stations by distance and couldn’t use this solution.

My thanks go on John at CashCommons and Philip. Thank you guys

  • 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-18T11:42:36+00:00Added an answer on May 18, 2026 at 11:42 am

    If your points are separated within a city (more or less), that approximation will work fine. The approximation falls apart if you go worldwide, though.

    EDIT: Based on Philip’s comment below, you should scale one of the components. Germany is about 50 degrees north latitude, so multiplying the longitude by (cos 50 deg) will do better.

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

Sidebar

Related Questions

I have two threads in an Android application, one is the view thread, and
I have android application and service that runs in separate process. Application and service
I'm writing an Android application for RC Cars. It uses a SQLite database, and
I'm using SQLite in an Android application. In all of my tables I have
I'm looking to implement my first Android database, but I have so many questions
I am pretty far into my first Android application, and I have the sneaking
I have an application for Android which communicates with a Google App Engine (GAE)
I have the data in the android(Sqlite Database).How to transfer this database data's to
I'm doing some Android development, and I much prefer Visual Studio, but I'll have
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a

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.