htmlgoogle-mapsjquery-gmap3

Get country name using geolocation with GMAP3.js


I'm new to the gmap3 plugin, and reading thru the documentation they show how to get lat an lng using geolocations. is it possible to get the country / state too?

here is the the code they use to get lat and lng

$('#test').gmap3({
  getgeoloc:{
    callback : function(latLng){
      if (latLng){
        $(this).gmap3({
          marker:{ 
            latLng:latLng
          },
          map:{
            options:{
              zoom: 5
            }
          }
        });
      }
    }
  }
});

Solution

  • From gmap3 plugin docs: This method allows to retrieve address. And this is the Google Maps API documentation page which lists possible fields.