Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how to find logitude/latitude of address & distance between 2 addresses

Posted on 2005-04-07
5
Medium Priority
?
736 Views
Last Modified: 2008-02-01
Hi,
This is not exactly a VB question (only I'm using VB to write the program).
Does anyone have info about how to:
1. Find out what the coordinate (longitude/latitude) of an address in U.S. is and
2. Find the distance between 2 addresses.
Doesn't have to be free, desirable but not mandatory.
Thanks a whole bunch.
Phil
0
Comment
Question by:spoowiz
5 Comments
 
LVL 12

Expert Comment

by:Bob Lamberson
ID: 13732873
Here is some stuff on EE, if you haven't already seen it
http://www.experts-exchange.com/Databases/GIS_GPS/All_Questions_6.html

Here is some programmable mapping software, just not vb
http://www.tetrad.com/pricing/usa/miussoft.html 


Bob
0
 
LVL 16

Accepted Solution

by:
JohnBPrice earned 2000 total points
ID: 13738509
An approximate distance calculation is below (it doesn't account for curvature of the earth)

Public Function CalcDistance(ByVal dblLat1 As Double, ByVal dblLg1 As Double, ByVal dblLat2 As Double, ByVal dblLg2 As Double, ByRef dblMiles As Double) As Boolean
'this function calculates the approximate distance between to points on the globe, given
'a starting point latitude/longitude and and ending point latitude/longitude/
Dim dblDistLat As Double
Dim dblDistLong As Double

dblDistLat = 69.1 * (dblLat2 - dblLat1)
dblDistLong = 69.1 * (dblLg2 - dblLg1) * Cos(dblLat1 / 57.3)
dblMiles = ((dblDistLat ^ 2) + (dblDistLong ^ 2)) ^ 0.5

CalcDistance = True
End Function

The exact calculation is
Distance = 3959 arcCos(Sin(Lat1)Sin(Lat2) +cos(Lat1)cos(Lat2)(Cos(Long2-Long1))

We buy a zip code database from www.MelissaData.com, which provide Lat & Long.
0
 
LVL 13

Expert Comment

by:imarshad
ID: 13744714
>>1. Find out what the coordinate (longitude/latitude) of an address in U.S. is

You will need to have a database of locations in U.S.....The database should have at least three fields if not more......

1) Latitude
2) Longitude
3) Address Info (Locations)

>>2. Find the distance between 2 addresses.

Once you know the Lat/Long of two places then calculating  distance between them can be done using a simple equation......

Distnace Between (long1,lat1) and (long2,lat2) = R * ACos[sin(lat1)*sin(lat2) + cos(lat1)*cos(lat2)*cos(long1-long2)]

Imran
0
 
LVL 13

Expert Comment

by:imarshad
ID: 13744724
Oh sorry I didnot noticed that JohnBPrice has already posted the formula......

Imran
0
 

Author Comment

by:spoowiz
ID: 13745023
Thank you for the formula and other who responded.

For address coordinate, I found out the zip+4 only has about 4 homes so it's close enough for me.
You can also get zipZ+4 files with coordinates at usps.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month21 days, 7 hours left to enroll

805 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