I'm using Google Maps Geocoding function. I got some addresses which I load into a PHP variable. The addresses are defined by a textbox which the user can type in a zip code. I give an example:
A user types in the textbox a postal code (12345 for example). Now it loads addresses from the system (this is internal - but it works to load the addresses). And then it display some addresses. These addresses are now stored in a PHP
variable ($address
). And now I want to get the latitude
and longitude
from these different addresses.
I had a look at this thread: Javascript geocoding from address to latitude and longitude numbers not working
I used this code from the article:
var latitude = results[0].geometry.location.lat();
var longitude = results[0].geometry.location.lng();
alert(latitude + ' - ' + longitude);
This is nice but it just give me the latlng
from the address I typed in the textbox, not from all the addresses I got.
Is there a way to get the latitude
and longitude
from all the different addresses? If yes, could someone please explain me? I'm new to JavaScript
and Google Maps API
.
Thanks in advance