Javascript Archives - 7-Views

Reverse Geocoding – Get formatted address from latitude and longitude

Posted by
July 3, 2020

<script> function getmylocation(lat, lng) { var currAddress, addtress= []; var geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(lat, lng); if (geocoder) { geocoder.geocode({‘latLng’: latlng}, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[0]) { currAddress = results[0].formatted_address; addtress.push(currAddress ); } else { alert(‘No results found’); } } else { alert(‘Geocoder failed due […]

read more

URIError: malformed URI sequence

Posted by
September 13, 2018

The point is that if you use single % it breaks the logic of decodeURIComponent() function as it expects two-digit data-value followed right after it, for example, %20 (space).┬áThere is a solution to this. We need to check first if the decodeURIComponent() actually can run on given string and if not return the string as […]

read more