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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:19:39+00:00 2026-06-18T12:19:39+00:00

Am developing MAP app. It saves several thousands for latitude & longitude details to

  • 0

Am developing MAP app. It saves several thousands for latitude & longitude details to draw overlay.
When user touches the overlay it wants to fetch the nearest latitude and longitude from the saved record in SQL.

I use:

SELECT * 
FROM track_points 
WHERE segmentId = '22' 
ORDER BY (ABS(latitude - 25.312005) + ABS(longitude - 91.730433))

It exactly does the same but the problem is when the particular overlay has several thousands of lat and longi details. It takes a long time to complete the above query.

It runs thought the entire DB data to get one point, even when the nearest data is fetched.

Just when 28.2525 is given I need something near 25.2520 or what ever it is and stop with that. I don’t want to start from 22.23252 or something in row 10 and reach 25.2520 at row 5000 and yet conti till the last row.

  • 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-18T12:19:41+00:00Added an answer on June 18, 2026 at 12:19 pm

    First, continue to investigate if Spatialite is what you need.

    However, you need to cut down the number of points that the query is considering:

    SELECT * 
    FROM track_points 
    WHERE segmentId = '22' 
    ORDER BY (ABS(latitude - 25.312005) + ABS(longitude - 91.730433))
    WHERE latitude BETWEEN 25.31 AND 25.32
          AND
          longitude BETWEEN 91.73 AND 91.74
    

    You want to set the boundaries as narrow as possible but wide enough to be sure you get at least one result. If your lattitude and longitude are a regular lattice then this is trivial.

    You can use BETWEEN @value - @tolerance AND @value + @tolerance to detrimine the values on the fly.

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

Sidebar

Related Questions

I'm developing an APP that get user specified latitude,longitude, and altitude, then fake this
I've started developing a small app which main goal is to draw a map
I am developing a map App in windows phone 7.5 platform. I need draw
I'm developing a Google Map API v2 app, where markers are loaded from a
i'm developing an app which download map tiles around different places in a city.
The app I am developing uses a tab bar with a Map View. The
I'm developing an iOS app based on the map and location tracking. When the
I'm currently developing an app which uses tabs and google map. What I want
I'm in the middle of developing android app using google map. My question is
I'm trying to add a Map element to an app that I'm developing. I

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.