centerAndZoom bad visualization

333
0
05-31-2019 06:58 AM
PauloMiranda_Arias
New Contributor

Hello. I'm using ArcGIS 3.28 API JS. I'm using `cenetrAndZoom()`method, but I have a problem. The map load after the zoom so the visualization is ugly, this is what happens when I change from one zoom to another:

centerandzoom

This is my code:

let center;
let zoom;
loadModules([
    'esri/geometry/Point'
]).then(([Point]) => {
    switch (evt.target.value) {
        case 'country_cl':
            center = new Point([-70.71582015815409, -33.47133434146025]);
            zoom = 4;
            break;
        case 'country_co':
            center = new Point([-73.63857136146157, 4.0920688808058]);
            zoom = 5;
            break;
        case 'country_mx':
            center = new Point([-99.94867549215655, 20.55088183550196]);
            zoom = 5;
            break;
        }
    // this.mapa.map.centerAndZoom(center, zoom);
    console.log(this.mapa.map);
    this.mapa.map.centerAndZoom(center, zoom);
    //this.mapa.map.centerAt(center);
    // this.mapa.map.setZoom(zoom);
    // this.mapa.map.panTo(center);
});

I would like to move first to the point and then zoom, but this method, changes the zoom while moving, so the map has to be reloaded. How can avoid this? If I move from Colombia-Mexico and viceversa there's no problem, because has the same zoom.

In the other hand, I set up this config:

esriConfig.defaults.map.zoomDuration = 500;
esriConfig.defaults.map.zoomRate = 25;
esriConfig.defaults.map.panDuration = 2500;
esriConfig.defaults.map.panRate = 25;
Tags (1)
0 Kudos
0 Replies