Solved

How to Inject latitude and longitude into a huge Access db

Posted on 2011-03-15
7
1,280 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

786 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