Skip to content

Instantly share code, notes, and snippets.

@RalucaNicola
Last active July 16, 2020 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RalucaNicola/da9583b86bc56278ef92475369d1092b to your computer and use it in GitHub Desktop.
Save RalucaNicola/da9583b86bc56278ef92475369d1092b to your computer and use it in GitHub Desktop.
(function() {
const view = require("esri/views/View").views.getItemAt(0);
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