我想知道特定位置周圍的谷歌街景圖像的位置(經度和緯度)。我該怎麼做 ? (谷歌地圖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. 谷歌街景圖像API
- 2. 谷歌街景位置限制
- 3. 谷歌街景
- 4. 羽毛與谷歌街景圖像
- 5. 谷歌地圖街景avaliable
- 6. 谷歌街景/地圖API
- 7. 谷歌地圖街景
- 8. 街景和谷歌地圖
- 9. 如何在谷歌街景中更改位置後退按鈕?
- 10. 谷歌街景API - 獲取街景
- 11. 谷歌地圖街景和全景
- 12. 通過全景圖ID而不是位置加載谷歌街景圖片API
- 13. 谷歌地圖與谷歌街景全景圖自定義全景圖衝突
- 14. iOS版谷歌街景API
- 15. 谷歌街景團結
- 16. 谷歌地圖API V3 - 在街景
- 17. 谷歌地圖 - 街景不起作用
- 18. 谷歌地圖街景鼠標
- 19. NullPointerException - 安卓谷歌地圖街景
- 20. 隨着谷歌街景視圖API
- 21. 檢測谷歌地圖街景模式
- 22. 谷歌街道查看API
- 23. 谷歌街景圖像沒有方向或攝像機角度
- 24. VR中的少年。谷歌地圖,谷歌街景和RTSP
- 25. 谷歌地圖街景「無圖像」,狀態爲OK
- 26. A-Frame(aframe.io)360度圖像(谷歌地圖類街景功能)
- 27. 如何在谷歌街景中通過panoid獲取原始全景圖像?
- 28. 谷歌街景鏈接(href)到自定義位置
- 29. 輸入地址並顯示谷歌街景位置
- 30. 谷歌地圖+街景的問題 - 如何禁用的Photo Sphere
謝謝您的回答。它對我有幫助。再次感謝。 – RomangRider