Description
An array of paths where each path is an array of points.
Samples
Search for
samples that use this class.
Class hierarchy
esri.geometry.Geometry
|_esri.geometry.Polyline
Constructors
Properties
Methods
Constructor Details
new esri.geometry.Polyline(spatialReference)
Creates a new Polyline object.
Parameters:
Code Snippet:
new esri.geometry.Polyline(new esri.SpatialReference({wkid:4326}));
new esri.geometry.Polyline(json)
Creates a new Polyline object using a JSON object.
Parameters:
| <Object> json | Required | JSON object representing the geometry. |
Code Snippet:
var polylineJson = {
"paths":[[[-122.68,45.53], [-122.58,45.55],
[-122.57,45.58],[-122.53,45.6]]],
"spatialReference":{"wkid":4326}
};
var polyline = new esri.geometry.Polyline(polylineJson);
Property Details
An array of paths. Each path is made up of an array of two or more points.
The type of geometry.
Known Values: point | multipoint | polyline | polygon | extent
Method Details
Adds a path to the Polyline. The path can be one of the following: an array of numbers, an array of points, or a JSON object. When added the index of the path is incremented by one.
The return value of Polyline was added at v1.4.
Code Snippet: Adding a path using Points:
polyline.addPath([new esri.geometry.Point(10,10), new esri.geometry.Point(20,20), new esri.geometry.Point(30,30)]);
Adding a path using an array of x,y coordinate pairs:
polyline.addPath([[-122.68,45.53], [-122.58,45.55], [-122.57,45.58],[-122.53,45.60]]);
Returns the extent of the Polyline.
getPoint(pathIndex,pointIndex)
Returns a point specified by a path and point in the path.
Input Parameters:
| <Number> pathIndex | Required | The index of a path in a polyline. |
| <Number> pointIndex | Required | The index of a point in a path. |
insertPoint(pathIndex,pointIndex,point)
Inserts a new point into a polyline.
Input Parameters:
| <Number> pathIndex | Required | Path index to insert point. |
| <Number> pointIndex | Required | The index of the inserted point in the path. |
| <Point> point | Required | Point to insert into the path. |
Removes a path from the Polyline. The index specifies which path to remove.
Input Parameters:
| <Number> pathIndex | Required | The index of a path to remove. |
removePoint(pathIndex,pointIndex)
Remove a point from the polyline at the given pointIndex within the path identified by the given pathIndex.
Input Parameters:
| <Number> pathIndex | Required | The index of the path containing the point. |
| <Number> pointIndex | Required | The index of the point within the path. |
setPoint(pathIndex,pointIndex,point)
Updates a point in a polyline.
Input Parameters:
| <Number> pathIndex | Required | Path index for updated point. |
| <Number> pointIndex | Required | The index of the updated point in the path. |
| <Point> point | Required | Point to update in the path. |
Sets the spatial reference.
The return value of Geometry was added at v1.4.
Input Parameters:
Converts object to its ArcGIS Server JSON representation.
Return Value: Object