Skip to content

Instantly share code, notes, and snippets.

@RalucaNicola
Created July 30, 2019 13:45
Show Gist options
  • Save RalucaNicola/9c96c1956af31a6409de6f3582b27819 to your computer and use it in GitHub Desktop.
Save RalucaNicola/9c96c1956af31a6409de6f3582b27819 to your computer and use it in GitHub Desktop.
const view = require("esri/views/View").views.getItemAt(0);
(function() {
const p = view.camera.position;
if (p.spatialReference.isWebMercator || p.spatialReference.isWGS84) {
console.log(`
{
position: [
${p.longitude.toFixed(8)},
${p.latitude.toFixed(8)},
${p.z.toFixed(5)}
],
heading: ${view.camera.heading.toFixed(2)},
tilt: ${view.camera.tilt.toFixed(2)}
}`);
}
else {
console.log(`
{
position: {
x: ${p.x.toFixed(5)},
y: ${p.y.toFixed(5)},
z: ${p.z.toFixed(3)},
spatialReference: ${p.spatialReference.wkid}
},
heading: ${view.camera.heading.toFixed(2)},
tilt: ${view.camera.tilt.toFixed(2)}
}`);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment