Solved

How to Inject latitude and longitude into a huge Access db

Posted on 2011-03-15
7
1,285 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

820 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