【发布时间】:2013-03-15 03:19:30
【问题描述】:
我正在使用 Google 的街景静态图像 API。它工作得很好,但我想知道是否可以获取我正在保存的图像的元数据,特别是日期。无论如何要知道静态图像的日期吗?
谢谢, 李
【问题讨论】:
我正在使用 Google 的街景静态图像 API。它工作得很好,但我想知道是否可以获取我正在保存的图像的元数据,特别是日期。无论如何要知道静态图像的日期吗?
谢谢, 李
【问题讨论】:
是的,您可以在 JavaScript 中使用Google Maps Street View Service 获取图像日期。
简而言之,您需要go through the usual setup steps 才能让 Google 地图在您的页面上运行,然后您可以执行以下操作:
var sv = new google.maps.StreetViewService();
var berkeley = new google.maps.LatLng(37.869085,-122.254775);
sv.getPanoramaByLocation(berkeley, 50, function(data) {
console.log(data.imageDate);
});
data.imageDate 将包含 YYYY-MM 格式的日期。
您可以使用 StreetViewService 的 getPanoramaById 和 getPanoramaByLocation 方法来获取此数据。请see here。
【讨论】:
var 全景选项 = { 位置:街景位置, 观点:{ 标题:0, 间距:5, 缩放:1 }, 可见:真实, 地址控制:假, imageDateControl:true };
【讨论】: