AnsweredAssumed Answered

Extent Code

Question asked by DougHaller on Apr 24, 2018
Latest reply on Apr 24, 2018 by DougHaller

How can I limit the geographical extent of an online map?


Specifically, I have two layers. One layer of my own data (hosted feature layer) and a second layer I am referencing.

My layer is specific to a major city. The second layer is state wide data. I want visitors to my site to be confined to a geographic area for viewing both layers. I would like the greatest extent of the view to be just the geographical area of my data (the major city).


(The reason is mainly to simplify the view. The data for the state-wide layer is unnecessary outside of the city that I am focused on.)


Note this is a student project for a course in online map design/development and I have only some ability with javascript.  Here is the reference I have found...


MapView | API Reference | ArcGIS API for JavaScript 4.7 



// Set the extent on the view

view.extent = new Extent({

xmin: -9177882,

ymin: 4246761,

xmax: -9176720,

ymax: 4247967,

spatialReference: {

wkid: 102100 } });