Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: FeatureTemplate

require(["esri/layers/FeatureTemplate"], function(FeatureTemplate) { /* code goes here */ });

Description

(Added at v2.0)
Feature templates define the information required to create a new feature.

Samples

Search for samples that use this class.

Constants

NameDescription
TOOL_ARROWThe default drawing tool specified for this template is the arrow tool. As of version 2.1
TOOL_AUTO_COMPLETE_POLYGONThe default drawing tool specified for this template is a auto complete polygon tool. .
TOOL_CIRCLEThe default drawing tool specified for this template is the circle tool. . The Editor dijit will map this to CREATE_TOOL_POLYGON.
TOOL_ELLIPSEThe default drawing tool specified for this template is a ellipse tool. The Editor dijit will map this to CREATE_TOOL_POLYGON.
TOOL_FREEHANDThe default drawing tool specified for this template is the freehand tool.
TOOL_LINEThe default drawing tool specified for this template is the line tool.
TOOL_NONENo default tool is specified.
TOOL_POINTThe default drawing tool specified for this template is the point tool.
TOOL_POLYGONThe default drawing tool specified for this template is the polygon tool.
TOOL_RECTANGLEThe default drawing tool specified for this template is the rectangle. As of version 2.1
TOOL_TRIANGLEThe default drawing tool specified for this template is the triangle. As of version 2.1

Properties

NameTypeSummary
descriptionStringThe description of the template.
drawingToolStringThe default drawing tool defined for the template.
nameStringThe templates name.
prototypeGraphicAn instance of the prototypical feature described by the template.
thumbnailObjectAn object used to create a thumbnail image that represents a feature type in the FeatureTemplate.

Methods

NameReturn typeSummary
toJson()ObjectConverts object to its ArcGIS Server JSON representation.
Property Details

<String> description

The description of the template.

<String> drawingTool

The default drawing tool defined for the template. See the constants table for a list of valid values.

<String> name

The templates name.

<Graphic> prototype

An instance of the prototypical feature described by the template. It specifies default values for the attribute fields and does not contain geometry.

Sample:

Create a feature based on a prototype.

require([
  "esri/layers/FeatureLayer", "esri/Graphic", ... 
], function(FeatureLayer, Graphic, ... ) {
  var featureLayer = new FeatureLayer( ... );
  var park = featureLayer.templates[0].prototype;
  var newPark = new Graphic(park.toJson());
  newPark.setGeometry(polygon);
  featureLayer.applyEdits([ newPark ]);
  ...
});

<Object> thumbnail

An object used to create a thumbnail image that represents a feature type in the FeatureTemplate. Use this property to override the default thumbnails depicting simple symbols when editing features from a map service represented with complex symbology. (Added at v3.18)
Object Specifications:
<thumbnail>
<string> contentType Required The MIME type of the image. This value may be image, png, jpg or jpeg.
<number> height Required The height of the thumbnail in points.
<string> imageData Required The base64EncodedImageData representing the thumbnail image.
<number> width Required The width of the thumbnail in points.
Method Details

toJson()

Converts object to its ArcGIS Server JSON representation. (Added at v2.1)
Return type: Object
Show Modal