Is there a 4.x version of esri/graphicsUtils? I'm trying to zoom to the extent of my IdentifyResult after hydrating the graphics into a GraphicsLayer. The GraphicsLayer, by default has an extent of the world, but it's not updated when graphics are added to it. Maybe this ability has moved to somewhere else in the 4.x API? Or, if someone has some code that could manually expand the extent as the response.results come in, I'd be very gracious!
Solved! Go to Solution.
You dont need graphicUtils to do that in 4.x. The mapView.goTo method takes Graphic[] as paramter and will zoom to the location of the graphics.
You dont need graphicUtils to do that in 4.x. The mapView.goTo method takes Graphic[] as paramter and will zoom to the location of the graphics.
Don't know if it would be helpful, but I was able use extent.expand() on an array of point graphics using two goTo() calls. Don't animate the first and call the second after the first resolves. That way, you can capture the view's extent on the first goTo() and expand on the second. Could be a workaround until graphicsUtils is added to 4.x. Hope it helps.
view.goTo(results.features, {animate: false}).then(function(response) {
var zoomView = {};
zoomView = view.extent.expand(2.0);
view.goTo(zoomView);
});
This is incredibly helpful, thank you!
With ESRI's removal of the ability to ensure a feature set fits the extent on zoom, this works as a great solution.
Truly, truly missing the ability to ensure the set extent fits on zoom.