在infowindow里面的街道视图

时间:2012-04-04 19:10:26

标签: javascript jquery css maps

我需要来自我的地图窗口的信息包含谷歌街景和文字的地方。谁能帮我解决?我正在学习编程,很难单独解决。谢谢(我的代码如下)

function initialize() {
var pinkParksStyles = [
    {
      featureType: "all",
      stylers: [
        { saturation: -80 }
      ]
    },
    {
      featureType: "poi.park",
      stylers: [
        { hue: "#ff0023" },
        { saturation: 40 }
      ]
    }
  ];

var pinkMapType = new google.maps.StyledMapType(pinkParksStyles,
    {name: "Paul em Floripa"});
var mapOptions = {
    zoom: 15,
    center: new google.maps.LatLng(-27.619279,-48.527896),
    mapTypeControlOptions: {
      mapTypeIds: [google.maps.MapTypeId.ROADMAP,'pink_parks','satellite' ]
    }
  };
var map = new google.maps.Map(document.getElementById('map_canvas'),  mapOptions);
var marker = new google.maps.Marker({})
var infowindow = new google.maps.InfoWindow();
var locations = [
                   ['Estacionamento 1', -27.627525,-48.52762, 1],
                   ['Estacionamento 2', -27.624374,-48.527786, 2],
                   ['Estacionamento 3', -27.620154,-48.529138, 3],
                   ['Estacionamento 4', -27.616161,-48.529588, 4],
                   ['Estacionamento 5', -27.61393,-48.533349, 5],
                   ['Estacionamento 6', -27.613129,-48.535352, 6],
                   ['Estacionamento 7', -27.612637,-48.530493, 7],
                   ['Estacionamento 8', -27.616962,-48.527746, 8],
                   ];


var marker, i;
  for (i = 0; i < locations.length; i++) {  
    marker = new google.maps.Marker({
      icon: 'images/stopcar.png',
      position: new google.maps.LatLng(locations[i][1], locations[i][2]),
      map: map
    });

google.maps.event.addListener(marker, 'click', (function(marker, i) {
      return function() {
        infowindow.setContent(locations[i][0]);
        infowindow.open(map, marker);
      }
   })(marker, i));
}

map.mapTypes.set('pink_parks', pinkMapType);
map.setMapTypeId('pink_parks');
trafficLayer.setMap(map);
}

1 个答案:

答案 0 :(得分:0)

好吧,我想你想在信息窗口放一个街景的静态图片。 如果是这种情况,请查看以下链接:https://developers.google.com/maps/documentation/streetview/

确切地写下了如何获取街景的静态图片以获取特殊位置。