Select to view content in your preferred language

MapView.goTo() not working when target is extent (even when extent is of same spatial reference as view)

854
1
Jump to solution
08-23-2022 06:51 PM
naveenanne
Occasional Contributor

@Rene @ReneP 

 

const extXY = new Extent({
    xmin: topLeftXY[0],
    xmax: bottomRightXY[0],
    ymin: bottomRightXY[1],
    ymax: topLeftXY[1],
    spatialReference: {
       wkid: 102100,
       latestWkid: 3857,
    },
});

//Not working
view.goTo({ target: extXY.extent.expand(1.33) }, { duration: 2000 });

//Working
view.extent = extXY.expand(1.33);

 

 

 

 

 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

It should work! It is hard to tell why it is not working without a reproducible case. In any case, I tested the following code snippet in 4.24 and it works. 

 

view.when(()=>{
  const extXY = new Extent({
    xmin: -9177811,
    ymin: 4247000,
    xmax: -9176791,
    ymax: 4247784,
    spatialReference: {
      wkid: 102100
    }
  });
  view.goTo({ target: extXY.expand(1.33) }, { duration: 2000 });
});

View solution in original post

1 Reply
UndralBatsukh
Esri Regular Contributor

Hi there, 

It should work! It is hard to tell why it is not working without a reproducible case. In any case, I tested the following code snippet in 4.24 and it works. 

 

view.when(()=>{
  const extXY = new Extent({
    xmin: -9177811,
    ymin: 4247000,
    xmax: -9176791,
    ymax: 4247784,
    spatialReference: {
      wkid: 102100
    }
  });
  view.goTo({ target: extXY.expand(1.33) }, { duration: 2000 });
});