我想知道特定位置周围的谷歌街景图像的位置(经度和纬度)。我该怎么做 ? (谷歌地图api,javascript,URL)我如何知道谷歌街景图像的位置?
-2
A
回答
0
从the documentation(重点煤矿):
直接访问街景数据
您可能希望以编程方式确定街景数据可用性,或返回关于特定全景的信息,而无需地图/全景的直接操作。您可以使用StreetViewService对象执行此操作,该对象提供存储在Google街景视图服务中的数据的界面。
您可以发起两种类型的请求到StreetViewService:
<snip>
- 请求与StreetViewLocationRequest这个搜索给出一个传递的LatLng在给定区域全景数据。
代码段(从this example in the documentation复制,在地图上点击返回最近的街景全景)
/*
* Click the map to set a new location for the Street View camera.
*/
var map;
var panorama;
function initMap() {
var berkeley = {
lat: 37.869085,
lng: -122.254775
};
var sv = new google.maps.StreetViewService();
panorama = new google.maps.StreetViewPanorama(document.getElementById('pano'));
// Set up the map.
map = new google.maps.Map(document.getElementById('map'), {
center: berkeley,
zoom: 16,
streetViewControl: false
});
// Set the initial Street View camera to the center of the map
sv.getPanorama({
location: berkeley,
radius: 50
}, processSVData);
// Look for a nearby Street View panorama when the map is clicked.
// getPanoramaByLocation will return the nearest pano when the
// given radius is 50 meters or less.
map.addListener('click', function(event) {
sv.getPanorama({
location: event.latLng,
radius: 50
}, processSVData);
});
}
function processSVData(data, status) {
if (status === google.maps.StreetViewStatus.OK) {
var marker = new google.maps.Marker({
position: data.location.latLng,
map: map,
title: data.location.description
});
panorama.setPano(data.location.pano);
panorama.setPov({
heading: 270,
pitch: 0
});
panorama.setVisible(true);
marker.addListener('click', function() {
var markerPanoID = data.location.pano;
// Set the Pano to use the passed panoID.
panorama.setPano(markerPanoID);
panorama.setPov({
heading: 270,
pitch: 0
});
panorama.setVisible(true);
});
} else {
console.error('Street View data not found for this location.');
}
}
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 100%;
}
<div id="map" style="width: 45%; height: 100%;float:left"></div>
<div id="pano" style="width: 45%; height: 100%;float:left"></div>
<!-- Replace the value of the key parameter with your own API key. -->
<script async defer src="https://maps.googleapis.com/maps/api/js?callback=initMap"></script>
0
Check this link out for geo location
应该给你正确的方向。它的工作原理上的人的IP地址,因此,如果他们的IP被屏蔽或重新路由,你不会得到准确的经度和纬度,但他们的ISP的位置
相关问题
- 1. 我如何整合谷歌位置视图和街景地图
- 2. 谷歌街景图像API
- 3. 谷歌街景位置限制
- 4. 谷歌街景
- 5. 羽毛与谷歌街景图像
- 6. 谷歌街景图像精度
- 7. 谷歌地图街景
- 8. 谷歌地图街景avaliable
- 9. 谷歌街景/地图API
- 10. 重置谷歌地图街景
- 11. 谷歌地图v3街景视图pegmen位置
- 12. 谷歌街景与
- 13. 谷歌如何知道我?
- 14. 如何在谷歌街景中更改位置后退按钮?
- 15. 谷歌街景API - 获取街景
- 16. 谷歌街景图片API参数“位置”
- 17. 谷歌街景全景,setOptions
- 18. 为什么我的谷歌街景图像得到403
- 19. 谷歌地图街景和全景
- 20. 谷歌地图/街景视图控件
- 21. 谷歌地图街景图标丢失
- 22. 通过全景图ID而不是位置加载谷歌街景图片API
- 23. 谷歌地图上的街景?
- 24. 谷歌地图SDK for iOS的街景?
- 25. 谷歌地图的街道名称不
- 26. 谷歌地图与谷歌街景全景图自定义全景图冲突
- 27. 谷歌街景视图图像上类似Insta的过滤器
- 28. 谷歌街景和AR
- 29. 嵌入式谷歌街景
- 30. iOS版谷歌街景API
谢谢您的回答。它对我有帮助。再次感谢。 – RomangRider