我需要帮助添加两件事。
var image =' 1368298974442034922android-car-home-256-th.png' 我想删除红色默认标记并添加此项
我不知道如何将其从地图更改为卫星视图
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Info windows</title>
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
.content
{
width:75%;
height:45px;
overflow:scroll;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<script>
// This example displays a marker at the center of Australia.
// When the user clicks the marker, an info window opens.
function initialize() {
var myLatlng = new google.maps.LatLng(36.3135749,-95.3050332);
var mapOptions = {
zoom: 20,
center: myLatlng
};
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var contentString = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h1 id="firstHeading" class="firstHeading">Here It Is!</h1>'+
'<div id="bodyContent">'+
'Acording to our records it looks like your item is located with in a few feet of here.<br><br> Need more info check out this info. <br> <a href="http://www.example.com">http://www.example.com</a></div>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Here Is Where We Found It!'
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
答案 0 :(得分:1)
标记:
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Here Is Where We Found It!',
icon: "1368298974442034922android-car-home-256-th.png"
});
卫星视图:
var mapOptions = {
zoom: 20,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.SATELLITE
};