Google Maps - Reverse Geolocation
How do I make an google maps - reverse geolocation?
Example of reverse geolocation with Google Maps API.. What is a google maps - reverse geolocation? How do you make a google maps - reverse geolocation? This script and codes were developed by Thulio Philipe on 09 January 2023, Monday.
Google Maps - Reverse Geolocation - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Google Maps - Reverse Geolocation</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="map-canvas"></div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://maps.googleapis.com/maps/api/js?signed_in=true'></script> <script src="js/index.js"></script>
</body>
</html>
Google Maps - Reverse Geolocation - Script Codes CSS Codes
#map-canvas { width: 100%; height: 500px; border: 1px solid black; display: inline-block;
}
Google Maps - Reverse Geolocation - Script Codes JS Codes
$(document).on('ready', function() { getLocation();
});
// pegando a localização do usuário
function getLocation() { // solicitando a geolocalização do usuário if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(success, error); } else { error('Não suportado!'); } // Função de sucesso para a geolocalização. function success(position) { console.log("A latitude é: " + position.coords.latitude); console.log("A longitude é: " + position.coords.longitude); // criando geocoder geocoder = new google.maps.Geocoder(); // mostrando o mapa na tela var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); var mapOptions = { zoom: 10, center: latlng, mapTypeId: 'roadmap' } map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); // criando infowindow var infowindow = new google.maps.InfoWindow; // efetuando o geocode a partir da localização do usuário geocoder.geocode({'latLng': latlng}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[1]) { map.setZoom(11); marker = new google.maps.Marker({ position: latlng, map: map }); infowindow.setContent(results[1].formatted_address); infowindow.open(map, marker); } else { alert('Sem resultados..'); } } else { alert('Geocoder falhou por conta de: ' + status); } }); // executa o mapa passando a função success quando o dom fizer o load google.maps.event.addDomListener(window, 'load', success); } // Função de error caso o navegador não suporte a geolocalização function error(msg) { console.log('error'); }
}
Developer | Thulio Philipe |
Username | thulioph |
Uploaded | January 09, 2023 |
Rating | 3 |
Size | 2,639 Kb |
Views | 6,072 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Select with plugin | 2,011 Kb |
Parallax with only CSS | 2,297 Kb |
Utilizando o Cycle | 1,846 Kb |
Tabs com css | 1,949 Kb |
Custom Google Maps API | 2,965 Kb |
Animated paths - Google Maps | 2,841 Kb |
Filter mixitup | 2,109 Kb |
Tilt Effect | 10,189 Kb |
Slideshow only with sass | 2,891 Kb |
Google static map to Base64 | 2,058 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Masonry | Uriuriuriu | 5,005 Kb |
Dribbble Inspired Registration Form | Lancebush | 2,358 Kb |
JS Countdown Timer | Ayoungh | 2,435 Kb |
SCSS Social Icons Flat | Mattsince87 | 3,482 Kb |
CSS Flip Animation | Bbodine1 | 2,525 Kb |
Template | Indra_z85 | 2,323 Kb |
My Starter Kit For Codepen | Dkdesign | 2,012 Kb |
Responsive Boxes without Images | Andymcfee | 4,120 Kb |
CSS Donut Charts | Seanstopnik | 2,908 Kb |
Airbnb Homepage | SindhujaD | 2,480 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!