I have a database of around 16000 records and i like to go through each address and get their latitude and longitude values.
I have tried exporting all records into excel sheet and then creat a macro to have a lat and lang values. It works for 80% of addresses, but google map api would return more results than Bing map as i have tried few addresses (which were not working with bing map) in google map and google is returning accurate values.
I like to use Google Map API to get latitude and longitude values as it has a limit of 25k requests per day.
I have got this java script which works fine but i don't know how can i use it with multiple addresses? I can loop through dataset but not sure if i need to call this java script function in the code behind page against every single address?
What is the best way to do this?
<script type="text/javascript">
<!--
function GetLocation() {
var geocoder = new google.maps.Geocoder();
var address = document.getElementById("txtAddress").value;
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var latitude = results[0].geometry.location.lat();
var longitude = results[0].geometry.location.lng();
alert("Latitude: " + latitude + "\nLongitude: " + longitude);
} else {
alert("Request failed.")
}
});
};
//-->
</script>