The camera coordinate system is changing on move.

04-01-2019 12:48 AM
Occasional Contributor

Hi I’m stuck here. I need to keep track of my XYZ of the camera, and assign that information to a point later in the script. I found out that the coordinate system seems to change, but not on my point. I need the point to always stay in front of my camera, but when it starts with:

x: 7.654 y: 45.919 Z: 5183 and changes to: x: 852275.0892005145 y: 5767392.023641216 Z: 5223.5517142592, then I’m a little lost in what to do. I could use some help in getting it to keep the prober coordinates on the camera. Thanks.


<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">

<link rel="stylesheet" href="">
<script src=""></script>

#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;

Map, SceneView, WebScene, GraphicsLayer, Graphic,watchUtils
) {

var scene = new Map({
basemap: "streets",
ground: "world-elevation"

var view = new SceneView({
map: scene,
container: "viewDiv",
camera: {
position: [7.654, 45.919, 5183],
tilt: 80},
padding: {
top: 40
var graphicsLayer = new GraphicsLayer();

cameraX =
cameraY =

watchUtils.whenTrue(view, "stationary", function() {
var info = "<br> <span> the view center changed. </span> x: " + + " y: " + + " Z: " + ;

function displayMessage(info) {
outputMessages.innerHTML += info;
outputMessages.scrollTop = outputMessages.scrollHeight;


<div id="viewDiv">
<div id="outputMessages"></div>
<div id="titleDiv"></div>


0 Kudos
3 Replies
MVP Esteemed Contributor


  Though you can set the camera using Geographic coordinates like you are, they will be projected to the basemaps coodinate system which is web mercator. You have access to a client side utility called WebMercatorUtils to do the conversion from WKID 102100 (web mercator) back to  WKID 4326 (Geographic).

Occasional Contributor

Hi Robert, thank you for taking you time to answer, I tried your answer, but I think I did it wrong, it didn’t had the outcome I was expecting. I changed the to and that seem to fix the issue.

Thank you

0 Kudos
MVP Esteemed Contributor


   So do you still have a question?

0 Kudos