1

I have a Javascript form where a user inputs an address, city, and state. When this form is submitted, I want the address to be converted into latitude and longitude, and to store those two values to a database. Any help at all is greatly appreciated!

Matt
  • 22,721
  • 17
  • 71
  • 112
Fusionice
  • 131
  • 1
  • 2
  • 9
  • @Pekka you are correct using Google map geocoding is only allow for within map, and permits storage only for improve performance of the map. @Fusionice for what purpose are you storing the lat lng for? – KJYe.Name Apr 22 '11 at 18:40
  • To display a Google map using the stored lat lng values – Fusionice Apr 22 '11 at 19:19

2 Answers2

0

Check this out:

http://batchgeo.com/lookup/

Brian Stinar
  • 1,080
  • 1
  • 14
  • 32
  • This would be perfect if I knew how to only display the output map on a page – Fusionice Apr 22 '11 at 19:24
  • Grab their map div. It's id="mapDiv". This is slightly ghetto, because if they change this, your stuff stops working. It'd be better if they had an API, but I didn't see one. – Brian Stinar Apr 22 '11 at 19:54
0

You can use the Google Maps API v3, example:

//get the input from user, in a normal looking address string
var add = this.ListingAddress + ', ' + this.ListingCity + ', ' + this.ListingZipCode;

var geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'address': add }, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
        var LatLong = results[0].geometry.location; //here is the LatLong
    } else {
        alert("Address not found! Error Code: " + status);
    }
});
thinkdevcode
  • 921
  • 1
  • 8
  • 13