Hi,
I am using the Google Maps API ACF pretty successfully so far, but there’s an area I’m stuck on. In my infoWindow for each marker, it sets the lat and long using:
<?php echo $location['lat']; ?>
<?php echo $location['lng']; ?>
Also, <?php echo $location['address']; ?>
works well as it outputs the full address, but I’m wanting to get specific parts of the address… specifically, country.
I have looked at the Google Map API and found this http://maps.googleapis.com/maps/api/geocode/json?latlng=57.486762,-4.247709&sensor=true but couldn’t work out if this sort of thing is even set up through Google Maps ACF.
For example:
<?php echo $location['administrative_area_level_1']; ?>
Thanks in advance,
R
Hi @rdck
You may have already found this, but here is a great stackoverflow forum that talk about finding more address data from a lat / lng:
http://stackoverflow.com/questions/4013606/google-maps-how-to-get-country-state-province-region-city-given-a-lat-long-va
You could either read in the url via PHP (server side), or do it with jQuery (client side).
Good luck
Cheers
E