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'); }
}
![Google Maps - Reverse Geolocation - Script Codes](http://shots.codepen.io/thulioph/pen/yizek-512.jpg)
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 |
Usando sharre | 1,897 Kb |
Menu - Forks Meal Planner | 5,432 Kb |
CSS Gradient border | 3,691 Kb |
Google static map to Base64 | 2,058 Kb |
Change favicon dynamically | 1,677 Kb |
Parallax with only CSS | 2,297 Kb |
Select with plugin | 2,011 Kb |
Slideshow only with sass | 2,891 Kb |
Pagination without plugin jQuery | 4,000 Kb |
Tabs com css | 1,949 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 |
Scroll to view if element partially out of view port height | ChrisMaki | 2,104 Kb |
Content Changer | Cliffpyles | 4,538 Kb |
Working around OS X Dynamic Scrollbars | Jrjenk | 2,279 Kb |
Modal Dialog | Gigaleet | 2,251 Kb |
3D-box | Parthviroja | 2,346 Kb |
Dribbble Inspired Registration Form | Lancebush | 2,358 Kb |
Stylize Stories | Jvhti | 2,465 Kb |
Pomodoro Timer | Sdas13 | 2,900 Kb |
A Pen by Mohomed Anees | Mohomedanees | 12,597 Kb |
Iron Man SVG Loading Animation | Andythayer | 3,069 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!