我想从谷歌街景中获取带有LatLng信息的图片。
https://developers.google.com/maps/documentation/javascript/
我在Google服务的文档中阅读了几乎所有内容,但我找不到我想要的选项。
还有什么我会把一件事作为参考吗?
答案 0 :(得分:2)
这里有一对来自Google sample1的好例子 和sample2 Whit建立一个合适的网页并包含所有相关信息并不是一件好事,这并不困难
sample2的代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Street View service</title>
<style>
html, body, #map-canvas {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
<script>
function initialize() {
var fenway = new google.maps.LatLng(42.345573, -71.098326);
var mapOptions = {
center: fenway,
zoom: 14
};
var map = new google.maps.Map(
document.getElementById('map-canvas'), mapOptions);
var panoramaOptions = {
position: fenway,
pov: {
heading: 34,
pitch: 10
}
};
var panorama = new google.maps.StreetViewPanorama(document.getElementById('pano'), panoramaOptions);
map.setStreetView(panorama);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas" style="width: 45%; height: 100%;float:left"></div>
<div id="pano" style="width: 45%; height: 100%;float:left"></div>
</body>
</html>
所有来自谷歌。