Javascript 谷歌地图V3:初始化街景&x2B;地理编码
Daer我在我的项目中设置了谷歌地图,效果很好。现在我想用“街景全景”而不是标准地图来初始化以下脚本 我在google开发者上找到了一个例子,但我无法将它与地理编码功能结合起来 那么,如果我想在这段代码中初始化街景而不是标准地图,该怎么办Javascript 谷歌地图V3:初始化街景&x2B;地理编码,javascript,google-maps,Javascript,Google Maps,Daer我在我的项目中设置了谷歌地图,效果很好。现在我想用“街景全景”而不是标准地图来初始化以下脚本 我在google开发者上找到了一个例子,但我无法将它与地理编码功能结合起来 那么,如果我想在这段代码中初始化街景而不是标准地图,该怎么办 var geocoder; var map; function initialize() { geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLn
var geocoder;
var map;
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(-34.397, 150.644);
var mapOptions = {
zoom: 16,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
}//*I need street view instead of standard map (StreetViewPanorama)
function codeAddress() {
var address = document.getElementById("address").value;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
html
<div id="map-canvas" style="width: 600px; height: 450px; float:right"></div>
<div>
<input id="address" type="text" value="Milan, Italy Viale Tunisia 30">
</div>