Google Maps V3 - Geocoder example - gists · GitHub

文章推薦指數: 80 %
投票人數:10人

Google Maps V3 - Geocoder example. GitHub Gist: instantly share code, notes, and snippets. Skiptocontent Allgists BacktoGitHub Signin Signup Sign in Sign up {{message}} Instantlysharecode,notes,andsnippets. lazarofl/geocoder_example.html CreatedOct16,2012 Star 8 Fork 10 Star Code Revisions 2 Stars 8 Forks 10 Embed Whatwouldyouliketodo? Embed Embedthisgistinyourwebsite. Share Copysharablelinkforthisgist. Clonevia HTTPS ClonewithGitorcheckoutwithSVNusingtherepository’swebaddress. LearnmoreaboutcloneURLs DownloadZIP GoogleMapsV3-Geocoderexample Raw geocoder_example.html ThisfilecontainsbidirectionalUnicodetextthatmaybeinterpretedorcompileddifferentlythanwhatappearsbelow.Toreview,openthefileinaneditorthatrevealshiddenUnicodecharacters. LearnmoreaboutbidirectionalUnicodecharacters Showhiddencharacters

GoogleMapsJavaScriptAPIv3Example:GeocodingSimple

Copylink Chizenbop commented Dec5,2014 Online50youhavedefined bodyonload="initialize()" whichcausesinitialize()toruntwice. Sorry,somethingwentwrong. Copylink ConfusedRunningGuy commented Mar22,2016 ActuallynoInitialize()isn'truntwiceonload,codeAddress()isruntwiceontheappslifecycle.Onceonloadandonceonabuttonclickevent,whichappearsfine Sorry,somethingwentwrong. Copylink neeraj87 commented Sep13,2016 $(document).ready(function(){ console.log('Doconload'); varaddress='SanDiego,CA'; vargeocoder=newgoogle.maps.Geocoder(); geocoder.geocode({'address':address},function(results,status){ if(status==google.maps.GeocoderStatus.OK){ if(status!=google.maps.GeocoderStatus.ZERO_RESULTS){ varlatitude=results[0].geometry.location.lat(); varlongitude=results[0].geometry.location.lng(); initialize(latitude,longitude); }else{ alert("Noresultsfound"); } }else{ alert("Geocodewasnotsuccessfulforthefollowingreason:"+status); } }); functioninitialize(latitude,longitude){ varlatlng=newgoogle.maps.LatLng(latitude,longitude); varmyOptions={ zoom:15, center:latlng, mapTypeId:google.maps.MapTypeId.ROADMAP, mapTypeControl:true }; varmap=newgoogle.maps.Map(document.getElementById('map'),myOptions); varmarker=newgoogle.maps.Marker({ position:latlng, map:map, title:'Location,propertyname' }); } }); Thisismycodeforgeocoder.Howeveritdoesnotshowanymap.Itneithergivesmeanyjavascripterrors.WhatamIdoingwrong? Sorry,somethingwentwrong. Copylink ReenaVerma commented Feb25,2018 likewise,nomapisappearingformeneither.. Sorry,somethingwentwrong. Signupforfree tojointhisconversationonGitHub. Alreadyhaveanaccount? Signintocomment Youcan’tperformthatactionatthistime. Yousignedinwithanothertaborwindow.Reloadtorefreshyoursession. Yousignedoutinanothertaborwindow.Reloadtorefreshyoursession.



請為這篇文章評分?