Found 13 Articles for Google maps

HTML5 Geolocation in Safari 5

George John
Updated on 25-Jun-2020 07:40:03

773 Views

HTML5 Geolocation API lets you share your location with your favorite web sites. A JavaScript can capture your latitude and longitude, can be sent to backend web server, and do fancy location-aware things like finding local businesses or showing your location on a map.ExampleLet us see how to get the current position −                    function showLocation(position) {             var latitude = position.coords.latitude;             var longitude = position.coords.longitude;             alert("Latitude : " + latitude + " ... Read More

Convert coordinates to a place name with HTML5

Anvi Jain
Updated on 25-Jun-2020 07:22:53

175 Views

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.ExampleLet 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.

How to best display HTML5 geolocation accuracy on a Google Map?

Rishi Rathor
Updated on 25-Jun-2020 06:46:14

268 Views

To display HTML5 geolocation accuracy on a Google Map, use the following code −var lat = position.coords.latitude; var longitude = position.coords.longitude; var accuracy = position.coords.accuracy; var center = new google.maps.LatLng(lat, longitude); var a = new google.maps.Marker({    position: center    map:    icon: }); var mySphere = new google.maps.Circle({    center: centerPosition,    radius: accuracy,    map:    fillColor:    fillOpacity:    strokeColor:    strokeOpacity: }); map.fitBounds(mySphere.getBounds());

Advertisements