您好需要一些关于使用街景的想法/建议,我正在获取使用地点 Api 按类型执行搜索的地点详细信息,下面是我的搜索地点代码
function SearchData(type){
$('#placedata').empty();
var myLatlng = new google.maps.LatLng(parseFloat(searchLatitute), parseFloat(searchLongitute));
map = new google.maps.Map(document.getElementById('map_canvas'), {
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: myLatlng,
zoom: 10});
var request = {location: myLatlng,rankBy: google.maps.places.RankBy.DISTANCE,types: [type]};
var service = new google.maps.places.PlacesService(map);
service.search(request, callback);
}
function callback(results, status,pagination) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
var place = results[i];
createMarker(place);
function createMarker(place) {
var placeLoc = place.geometry.location;
var marker = new google.maps.Marker({map: map,zIndex: 100,position: place.geometry.location});
var request = {reference: place.reference};
service = new google.maps.places.PlacesService(map);
service.getDetails(request, function(details, status) {//alert("address "+details.formatted_address);
if (status == google.maps.places.PlacesServiceStatus.OK) {
$('#placedata').append('<tr><td><a href='+details.url+'>'+details.name+'</a></td></tr>');
}
});
我在我的网页中显示结果..我想要实现的是为每个地址添加街景。任何建议,将不胜感激。