问题是针对 DroneDeploy 平台的。
到目前为止,我的方法是获得 lat 或 lng 的最大差异,根据差异的大小分配缩放并获得一个平铺:
..
var maxLat, minLat, maxLng, minLng, zoom;
plan.geometry.map(function(node){
maxLat==undefined ? maxLat=node.lat : (node.lat > maxLat ? maxLat = node.lat : false)
minLat==undefined ? minLat=node.lat : (node.lat < minLat ? minLat = node.lat : false)
maxLng==undefined ? maxLng=node.lng : (node.lng > maxLng ? maxLng = node.lng : false)
minLng==undefined ? minLng=node.lng : (node.lng < minLng ? minLng = node.lng : false)
})
if (maxLat-minLat > maxLng-minLng){
if ((maxLat-minLat)*1000>1 && (maxLat-minLat)*1000<2){ zoom = 17; }
// other scopes for zoom levels here
else if ((maxLat-minLat)*100>1 && (maxLat-minLat)*100<9){ zoom = 8; }
}else{
if ((maxLng-minLng)*1000>1 && (maxLng-minLng)*1000<2){ zoom = 17; }
// other scopes for zoom levels here
else if ((maxLng-minLng)*100>1 && (maxLng-minLng)*100<9){ zoom = 8; }
}
dronedeploy.Tiles.get({planId: plan.id, layerName: 'ortho', zoom: zoom})
.then(function(tileInformation){
const tiles = getTilesFromGeometry(plan.geometry, tileInformation.template, zoom); // getTileFromGeometry function take from https://dronedeploy.gitbooks.io/dronedeploy-apps/content/tiles/example-tiles-as-array.html
console.log(tiles);
});
..
- 有没有更好的预览方式?当有人从 DroneDeploy 收到有关与您共享地图的电子邮件时,电子邮件中嵌入了地图预览。我猜他们使用了一些未记录的 API 来实现我上面描述的方法或相同的方法。
- 仅当我是地图的所有者时才有效,而不是在地图与我共享的情况下。我使用返回的路径:
<Error> <Code>AccessDenied</Code> <Message>Access Denied</Message> <RequestId>774DCD7F4D31201F</RequestId> <HostId> 8dVjSI4yj/Ag3AJlV9NOZrZES8IXnCDp5kwmN7qjsoOX91+325FM6xlHUQ5QIsH9ZcMYTZwBym4= </HostId> </Error>
这种情况有解决方法吗?