Class: FeatureTemplate

Description

Class added v2.0.

Feature templates define the information required to create a new feature.

Samples

Search for samples that use this class.  

Class hierarchy

esri.layers.FeatureTemplate

Properties

Property Type Description
description String The description of the template.
drawingTool String The default drawing tool defined for the template. See the constants table for a list of valid values.
name String The templates name.
prototype Graphic

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

Constants

Constant Description
TOOL_ARROW The default drawing tool specified for this template is the arrow tool. As of version 2.1
TOOL_AUTO_COMPLETE_POLYGON The default drawing tool specified for this template is a auto complete polygon tool. .
TOOL_CIRCLE The default drawing tool specified for this template is the circle tool. . The Editor dijit will map this to CREATE_TOOL_POLYGON.
TOOL_ELLIPSE The default drawing tool specified for this template is a ellipse tool. The Editor dijit will map this to CREATE_TOOL_POLYGON.
TOOL_FREEHAND The default drawing tool specified for this template is the freehand tool.
TOOL_LINE The default drawing tool specified for this template is the line tool.
TOOL_NONE No default tool is specified.
TOOL_POINT The default drawing tool specified for this template is the point tool.
TOOL_POLYGON The default drawing tool specified for this template is the polygon tool.
TOOL_RECTANGLE The default drawing tool specified for this template is the rectangle. As of version 2.1
TOOL_RECTANGLE The default drawing tool specified for this template is the rectangle tool.
TOOL_TRIANGLE The default drawing tool specified for this template is the triangle As of version 2.1

Methods

Method Return Value Description
toJson() Object Converts object to its ArcGIS Server JSON representation.
Properties Detail

<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.

Code snippets:

Create a feature based on a prototype.

var park = featureLayer.templates[0].prototype;
var newPark = new esri.Graphic(park.toJson());
newPark.setGeometry(polygon);
featureLayer.applyEdits([ newPark ]);

Methods Detail

toJson()

Converts object to its ArcGIS Server JSON representation. (As of v2.1)
Return value: Object