Solved

LATITUDE AND LONGITUDE

Posted on 2014-09-15
8
197 Views
Last Modified: 2014-09-15
Hello,

How do I add, and substract 1 mile for a given latitude? And 1 mile to a given longitude?

Thanks!
0
Comment
Question by:SimpleDude
  • 3
  • 3
  • 2
8 Comments
 
LVL 27

Expert Comment

by:d-glitch
Comment Utility
Latitude is easy.  Longitude is more complicated.

    http://www.answers.com/Q/How_many_miles_are_in_a_degree_of_longitude_or_latitude
0
 
LVL 84

Accepted Solution

by:
ozo earned 400 total points
Comment Utility
latitude + 0.014457
longitude + 0.014481/cos(latitude)
0
 
LVL 27

Assisted Solution

by:d-glitch
d-glitch earned 100 total points
Comment Utility
And you need to be careful at the boundaries:  the N and S poles, the equator, the prime (0 deg) meridian and its opposite (180 deg).
0
 

Author Comment

by:SimpleDude
Comment Utility
Hi guys, I just need to select X number of records within a Lat and Long range.

I was using this formula, but it drastically decreases the server performance:

  (ACOS(SIN(47.988594 * PI() / 180) * SIN(dbo.ADDRESSES.latitude * PI() / 180) + COS(47.988594 * PI() / 180) * COS(dbo.ADDRESSES.latitude * PI()
                      / 180) * COS((- 122.201789 - dbo.ADDRESSES.longitude) * PI() / 180)) * 180 / PI() * 60 * 1.1515 BETWEEN 0 AND @distance
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 27

Expert Comment

by:d-glitch
Comment Utility
How big is the data base?  Is it sorted in any way?
What units are used in the database?  Degrees or radians?
You should search in the same units the data base uses.  Save a lot on conversions.

This   (SIN(47.988594 * PI() / 180)  (and several similar terms) are constants.  
You only have to calculate them once.

Is this related to the nearest k restaurants problem?
0
 

Author Comment

by:SimpleDude
Comment Utility
Something like that. The point of origin (lat-long) changes constantly, that's why I cannot calculate it just once.
0
 
LVL 84

Expert Comment

by:ozo
Comment Utility
If the restaurants are in a small area, it may be preferable to convert the latitudes and longitudes into a flat grid to make distance calculations easier.
If the restaurants are in a large area where a flat approximation would be inaccurate, it may be preferable to convert into a 3-d orthogonal coordinate system to make distance calculations easier.
0
 

Author Closing Comment

by:SimpleDude
Comment Utility
Thanks guys
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
.NET NamedPipe access using ip address 5 50
DataGridView 2 28
asp.net mvc5 3 35
SQl help with selection 14 43
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Foreword (May 2015) This web page has appeared at Google.  It's definitely worth considering! https://www.google.com/about/careers/students/guide-to-technical-development.html How to Know You are Making a Difference at EE In August, 2013, one …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now