I have some JavaScript that queries for a parcel in a feature layer, successfully, and then zooms to the parcel using view.goTo(). It works great, except it zooms a little TOO close into the parcel. I'd like to have it fully display the parcel on the map, not go too far in. Any ideas?
Using ESRI's JavaScript 4.4 API
view.then(function() {
var url = urlUtils.urlToObject(document.URL);
if (url.query) {
var parcelNumber = url.query.PID;
return parcelLayer.then(function() {
var query = parcelLayer.createQuery();
query.where = "PID_NUM = '" + parcelNumber + "'";
query.outSpatialReference = view.spatialReference;
return parcelLayer.queryFeatures(query);
});
}
})
.then(zoomTo)
.then(highlight);
function zoomTo(response) {
var parcel = response.features[0];
view.goTo(parcel);
return (parcel);
}
Here is my zoomed map with the code above -- as you can see, it's not showing the full extent of the polygon I need to have zoomed into:

Here is a more preferable view one click zoomed out (though I'd rather have the polygon fill the space, but be completely visible in the map):

Thanks for any ideas.