Solved

How to Inject latitude and longitude into a huge Access db

Posted on 2011-03-15
7
1,270 Views
Last Modified: 2012-06-22
Hi Experts,

I currently own a huge Access database with 60.000 records.

Those records have a Name, Address, Area, Postal Code, Phone Number

I want to find the longitude and the latitude of the Address field witch is linked to the Area.

So we have the following schema:

32, Example Street, New York.


I know that i can manually search and add the long/lat into the db, but with 60.000 records this could take a lifetime.

Is there an easier way to do this? Maybe with a php/mysql script, but i don't know how. Can i convert the Access Database to mySQL an do this using a PHP script?


I know that this could generate errors in location, but if we link the postal code to the above schema it's possible to eliminate this.
0
Comment
Question by:PredatorGR
  • 3
  • 3
7 Comments
 
LVL 51

Expert Comment

by:HainKurt
ID: 35141577
maybe this help

http://geocoder.us/

they ask for $50 for 20K lookup, so in your case $150 :)

but maybe you can find a free geo web service... if you find this, just create a script (vb & asp or an application) loop all records, get the address, call web service, get values, update your db...
if your app crashes, continue with null values in long * lat columns...
0
 

Author Comment

by:PredatorGR
ID: 35141612
Thanks for the ultra fast reply HainKurt.

i bumped on this site earlier on my google search:
http://www.vbdotnetheaven.com/UploadFile/scottlysle/FreeGeocoderVB01242008090945AM/FreeGeocoderVB.aspx

Problem is, i'm not in the US and i don't know how to make an app like that.

i also bumped on this:
http://www.codeforexcelandoutlook.com/excel-vba/latitude-longitude-functions/

Scroll down to Google Maps API returns Latitude/Longitude to see an example.

How i can make this work?
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 35141836
what about this

http://local.yahooapis.com/MapsService/V1/geocode?appid=sGmf70bV34H6QgDaDk.tLer1VOJZEf.P7nZPi2V8MMmFDEQ_f30ByzwxgTI-&street=your  street address&country=ca&zip=XXXXXXXX

it will return you xml which you can save it to somewhere or get the Long & Lat values from here and update your table

or put all your address info in your excel and create a udf and call this function to get values

<?xml version="1.0" ?> 
- <ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:yahoo:maps" xsi:schemaLocation="urn:yahoo:maps http://local.yahooapis.com/MapsService/V1/GeocodeResponse.xsd">
- <Result precision="address">
  <Latitude>33.554939</Latitude> 
  <Longitude>-75.748924</Longitude> 
  <Address>xxxxxxx</Address> 
  <City>Mississauga</City> 
  <State>ON</State> 
  <Zip>L5M</Zip> 
  <Country>CA</Country> 
  </Result>
  </ResultSet>

Open in new window

0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 51

Accepted Solution

by:
HainKurt earned 500 total points
ID: 35141901
this url works fine for Canada

http://local.yahooapis.com/MapsService/V1/geocode?appid=sGmf70bV34H6QgDaDk.tLer1VOJZEf.P7nZPi2V8MMmFDEQ_f30ByzwxgTI-&street=Your City Address Here&city=Your City&state=NA&country=Caountry Here

on the page there are lots of excel functions... use one of them, create the url and get the result in xml
extract Long & latitude and update cells
then from excel update your db (copy paste is easiest way)
0
 
LVL 17

Expert Comment

by:nanharbison
ID: 35143096
You can get a free database of zipcodes with latitude and longitude here
http://www.boutell.com/zipcodes/
0
 

Author Comment

by:PredatorGR
ID: 35146838
Thanks all the experts for the replies.

I finally made it this way:

entered the excel data, i pressed the "Validate & Set Options" so i can validate witch cell is witch according to the Address, postal code etc.
i pressed the "Make Google Map"
after pressing the button i waited for the geocoding to finish
After the job is done, i pressed "Save And Continue"
i entered the name, description and my email on the box,
Waited a few seconds for the map to be created
Then i scrolled all the way down from the browser's side bar and i downloaded the goolgle KML file
i renamed the file to .xml from .kml and i imported it into excel
After using those 2 formulas: =LEFT(E2;FIND(",";E2)-1)and
=MID(E2;FIND(",";E2)+1;FIND(",";E2;FIND(",";E2)+1)-FIND(",";E2)-1)
i teared down the format 23.7515439,37.9776524,0 in two new cells (lang,lat) to two separate values of 23.7515439 and 37.9776524 (without the ,0 in the end). If someone ever use this method, you should change the E2,E1 field to the according fields of his excel file.

I hanv't tried yet to see how many records this site can translate, i think 2.500 is maximum so i have to split down the work to multiple browsers.
0
 

Author Closing Comment

by:PredatorGR
ID: 35146857
Thanks for your help!! much appreciated! i think the other way is much easier, but you pointed on the right way of xml.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 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

20 Experts available now in Live!

Get 1:1 Help Now