0
私は自分のサイトにgoogleマップモジュールが必要です。地図はポストコードに従って表示する必要があります。郵便番号は自動的に住所/緯度&経度に変換されます。asp.netの郵便番号に基づいてページ内のダイナミックマップを取得する方法は?
私は自分のサイトにgoogleマップモジュールが必要です。地図はポストコードに従って表示する必要があります。郵便番号は自動的に住所/緯度&経度に変換されます。asp.netの郵便番号に基づいてページ内のダイナミックマップを取得する方法は?
まあ、私はグーグルで返さ緯度&経度と場所を設定しその後のような... PHPで.. ..コードを見つけるAJAX呼び出しを行うと、それは緯度と経度を返しますしてくださいということ
$address = $this->input->post('address');
$output = array();
$address = str_replace(" ", "+", $address);
$region = "IND";
$json = file_get_contents("http://maps.google.com/maps/api/geocode/json?address=$address&sensor=false®ion=$region");
$json = json_decode($json);
if (!empty($json->{'results'}[0]->{'geometry'}->{'location'}->{'lat'})) {
$output['latitude'] = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lat'};
$output['longitude'] = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lng'};
return $output;
}
をしました地図API
//var latlng = new google.maps.LatLng(-104.017031, 15.373535);
var latlng = new google.maps.LatLng(latitude,longitude);
var map = new google.maps.Map(document.getElementById('map'), {
center: latlng,
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var marker = new google.maps.Marker({
position: latlng,
map: map,
title: 'Set lat/lon values for this property',
raiseOnDrag: true,
draggable: true
});
google.maps.event.addListener(marker, 'dragend', function(a) {
console.log(a);
$('#latitude').val(a.latLng.lat().toFixed(4));
$('#longitude').val(a.latLng.lng().toFixed(4));
// var div = document.createElement('div');
// div.innerHTML = a.latLng.lat().toFixed(4) + ', ' + a.latLng.lng().toFixed(4);
// document.getElementsByTagName('body')[0].appendChild(div);
});
が、これは
のホープページでGoogleのmap.jsファイルを添付してください