16
このスニペットを使用するか、ジオコーディングリクエストを使用してLatとLngの代わりに郵便番号を使用する方法があるのだろうかと思います。代わりに郵便番号を使用する方法GoogleマップのLatとLng API
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(22.1482635,-100.9100755);
// var latlang = new google.maps.zipcode(7845); <- Is there a way to do that?
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var marker = new google.maps.Marker({
position: latlng,
map: map,
title:"zipcode"
});
}
</script>
実例をありがとう。 –
エラーが発生します。プロパティアドレス:文字列ではありません。 –
郵便番号を文字列として渡すと南アフリカに行きます(ベルギーの郵便番号8790を試しています)。郵便番号を整数として渡すと@ Mohd.Umarと同じエラーを返します。 – AlvaroAV