javascript - How to get a tile representing a preview of a plan? -


question dronedeploy platform.

by approach getting max difference in lat or lng, assign zoom according how big difference , tile:

.. 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 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 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 https://dronedeploy.gitbooks.io/dronedeploy-apps/content/tiles/example-tiles-as-array.html         console.log(tiles);     }); .. 
  1. is there better way preview? when 1 email dronedeploy map being shared you, there map preview embedded in email. guess use undocumented apis or same approach described above.
  2. it works if owner of map, not in case map shared me. using returned path:
<error>     <code>accessdenied</code>     <message>access denied</message>     <requestid>774dcd7f4d31201f</requestid>     <hostid> 8dvjsi4yj/ag3ajlv9nozrzes8ixncdp5kwmn7qjsoox91+325fm6xlhuq5qish9zcmytzwbym4=     </hostid> </error> 

is there workaround such case?


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -