javascript - Not able to geo code japanese address using google API -
i implementing http://jsfiddle.net/zf6lg/ reverse geocoding.
$(function () { var lat = 44.88623409320778, lng = -87.86480712897173, latlng = new google.maps.latlng(lat, lng), image = 'http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png'; //zoomcontrol: true, //zoomcontroloptions: google.maps.zoomcontrolstyle.large, var mapoptions = { center: new google.maps.latlng(lat, lng), zoom: 13, maptypeid: google.maps.maptypeid.roadmap, pancontrol: true, pancontroloptions: { position: google.maps.controlposition.top_right }, zoomcontrol: true, zoomcontroloptions: { style: google.maps.zoomcontrolstyle.large, position: google.maps.controlposition.top_left } }, map = new google.maps.map(document.getelementbyid('map_canvas'), mapoptions), marker = new google.maps.marker({ position: latlng, map: map, icon: image }); var input = document.getelementbyid('searchtextfield'); var autocomplete = new google.maps.places.autocomplete(input, { types: ["geocode"] }); autocomplete.bindto('bounds', map); var infowindow = new google.maps.infowindow(); google.maps.event.addlistener(autocomplete, 'place_changed', function (event) { infowindow.close(); var place = autocomplete.getplace(); if (place.geometry.viewport) { map.fitbounds(place.geometry.viewport); } else { map.setcenter(place.geometry.location); map.setzoom(17); } movemarker(place.name, place.geometry.location); $('.maplat').val(place.geometry.location.lat()); $('.maplon').val(place.geometry.location.lng()); }); google.maps.event.addlistener(map, 'click', function (event) { $('.maplat').val(event.latlng.lat()); $('.maplon').val(event.latlng.lng()); infowindow.close(); var geocoder = new google.maps.geocoder(); geocoder.geocode({ "latlng":event.latlng }, function (results, status) { console.log(results, status); if (status == google.maps.geocoderstatus.ok) { console.log(results); var lat = results[0].geometry.location.lat(), lng = results[0].geometry.location.lng(), placename = results[0].address_components[0].long_name, latlng = new google.maps.latlng(lat, lng); movemarker(placename, latlng); $("#searchtextfield").val(results[0].formatted_address); } }); }); function movemarker(placename, latlng) { marker.seticon(image); marker.setposition(latlng); infowindow.setcontent(placename); //infowindow.open(map, marker); } });
but in address field when enter japanese address "東京都新宿区市谷砂土原町319" (which "ichigayasadoharacho, shinjuku, tokyo, japan") , press tab (onchange) not change map.
i not able figure out why not work. searching address = "東京都新宿区市谷砂土原町319" in maps.google.com shows map perfectly.
any appreciated.
Comments
Post a Comment