How do I get a default or initial extent from my ArcGIS without hard-coding it? For example, whenever a FeatureSet is not populated after executing a QueryTask, the mapview goes to the middle of the ocean instead of somewhere in my map area. If I can get the extent then I could zoom to it.
if (featureSet.features && !featureSet.features.length > 0) {
view.goTo({
target: view.extent
}, ZoomOptions);
}
The returned extent from the zero results query doesn't have a valid extent, obviously.
type:"extent"
width:0
xmax:0
xmin:0
ymax:9688.393335133032
ymin:-9688.393335133032
zmax:undefined
zmin:undefined
I want the exent from here
https://gis.manateepao.com/arcgis/rest/services/Website/WebLayers/MapServer/256
Gregory,
The extent used in the goTo method has to have the same spatial reference as the map view does. So you would need to re-project that extent info before you use it in the goTo method.
Thanks. Setting the initial long\lat to specific location when a featureset is not found is working out for me.
var view = new MapView({
map: map,
center: [-82.414233, 27.491344]