Creating the FeatureLayer
The FeatureLayer
must reference a layer from either a map service or a feature service. Use a map service if you just want to retrieve geometries and attributes from the server and symbolize them yourself. Use a feature service if you want to take advantage of symbols from the service's source map document. Also, use a feature service if you plan on performing web-based editing with the FeatureLayer
. Feature layers honor any feature editing templates configured in the source map document.
The following code example shows how to create a FeatureLayer
using its constructor. With tiled and dynamic layers, you simply provide a pointer to the REST endpoint of a map service, but with theĀ FeatureLayer
, you need to point to a specific layer in the service. In the following code example, we are creating a FeatureLayer
from the first layer in the service, which is indicated by the number 0. The constructor for FeatureLayer
also accepts options such as the display mode, output...