AnsweredAssumed Answered

MapView.Center Coordinate Problem

Question asked by justin.s.haas on May 18, 2018

I modified the Recenter example to have a history array instead of just a single initial center point to pull back to however some translation of my coordinates is happening when I don't want it to happen.  The code is:

private _defaultCenter() {
 let lastState:State = this.history.pop();
 let lastCenter:Coordinates = {x: lastState.x, y: lastState.y};
 this.view.center = lastCenter;
}

This seems to work fine except that before the last line of code both this.view.center and lastCenter have values of (-11168684, 5417593) and afterwards, lastCenter is of course unchanged at (-11168684, 5417593) but this.view.center is now very very big (-1243292272627, 103676511) so they're being translated in some way.. I tried dividing by the maps scale, but not luck, the X and Y don't even seem to be being scaled by the same factor so I'm a bit at a loss.  I'm guessing there's some sort of projection trick I"m missing but not entirely sure what that'd be.

Outcomes