Convert coordinates to a place name with HTML5

Google mapsJavascriptWeb DevelopmentFront End Scripts

For this, use Google Maps API to perform reverse geocoding.

Geocoding refers to translating a human-readable address into a location on a map.

The process of doing the converse, translating a location on the map into a human-readable address, is known as reverse geocoding.

Example

Let us see an example to set latitude and longitude −

function initMap() {
   var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 8,
      center: {lat: 20.502, lng: -22.765}
   });
}

The reverse geocoder will match countries, provinces, cities and neighborhoods, street addresses, and postal codes.

raja
Published on 06-Apr-2018 09:18:27
Advertisements