Description
The esri.geometry namespace has several utility methods associated with it. These methods are convenience methods that are not associated with any class.
Methods
| esri.geometry.fromJson(json) |
Object
|
Converts the input JSON object to the appropriate esri.geometry.* object. |
| esri.geometry.geographicToWebMercator(geometry) |
Geometry
|
Converts geometry from geographic units to Web Mercator units. |
| esri.geometry.getJsonType(geometry) |
String
|
Requests the geometry type name as represented in the ArcGIS REST. |
| esri.geometry.getLength(point1, point2) |
Number
|
Calculates the length of a line based on the input of two points. |
| esri.geometry.getLineIntersection(line1start, line1end, line2start, line2end) |
Point
|
Calculates the intersecting point of two lines. If the lines are parallel, a null value is returned. |
| esri.geometry.getScale(extent, mapWidth, wkid) |
Number
|
Gets the current scale of the map. |
| esri.geometry.isClockwise(ring) |
Boolean
|
Checks if a Polygon ring is clockwise. Returns true for clockwise and false for counterclockwise. |
| esri.geometry.toMapGeometry(extent, width, height, mapGeometry) |
Geometry
|
Converts the geometry argument to map coordinates based on the extent, width, and height of the Map. |
| esri.geometry.toMapPoint(extent, width, height, screenPoint) |
Point
|
Converts and returns the argument screen point in map coordinates. Deprecated at v1.1. Use toMapGeometry instead. |
| esri.geometry.toScreenGeometry(extent, width, height, screenGeometry) |
Geometry
|
Converts the geometry argument to screen coordinates based on the extent, width, and height of the Map. |
| esri.geometry.toScreenPoint(extent, width, height, mapPoint) |
Point
|
Converts and returns the argument map point in screen coordinates. Deprecated at v1.1. Use toScreenGeometry instead. |
| esri.geometry.webMercatorToGeographic(geometry) |
Geometry
|
Converts geometry from Web Mercator units to geographic units. |
Methods Detail
esri.geometry.fromJson(json)
Converts the input JSON object to the appropriate esri.geometry.* object.
Return value: Object
Input Parameters:
|
<Object> json |
Required |
The JSON object. |
esri.geometry.geographicToWebMercator(geometry)
Converts geometry from geographic units to Web Mercator units. (As of v1.4)
Input Parameters:
|
<Geometry> geometry |
Required |
The geometry to convert. |
Code snippets:
var geom = esri.geometry.geographicToWebMercator(candidate.location);
esri.geometry.getJsonType(geometry)
Requests the geometry type name as represented in the ArcGIS REST.
Return value: String
Input Parameters:
|
<Geometry> geometry |
Required |
The ArcGIS JavaScript API geometry type to be converted. |
esri.geometry.getLength(point1, point2)
Calculates the length of a line based on the input of two points.
Return value: Number
Input Parameters:
|
<Point> point1 |
Required |
The beginning point. |
|
<Point> point2 |
Required |
The ending point. |
esri.geometry.getLineIntersection(line1start, line1end, line2start, line2end)
Calculates the intersecting point of two lines. If the lines are parallel, a null value is returned.
Input Parameters:
|
<Point> line1start |
Required |
The beginning point of the first line. |
|
<Point> line1end |
Required |
The ending point of the first line. |
|
<Point> line2start |
Required |
The beginning point of the second line. |
|
<Point> line2end |
Required |
The ending point of the second line. |
esri.geometry.getScale(extent, mapWidth, wkid)
Gets the current scale of the map. (As of v1.4)
Return value: Number
Input Parameters:
esri.geometry.isClockwise(ring)
Checks if a
Polygon ring is clockwise. Returns true for clockwise and false for counterclockwise.
Return value: Boolean
Input Parameters:
esri.geometry.toMapGeometry(extent, width, height, mapGeometry)
Converts the geometry argument to map coordinates based on the extent, width, and height of the
Map.
(As of v1.1)
Input Parameters:
|
<Extent> extent |
Required |
The current extent of the map in map coordinates. |
|
<Number> width |
Required |
The current width of the map in map units. |
|
<Number> height |
Required |
The current width of the map in map units. |
|
<Geometry> mapGeometry |
Required |
The geometry to convert from screen to map units. |
esri.geometry.toMapPoint(extent, width, height, screenPoint)
Converts and returns the argument screen point in map coordinates.
Deprecated at v1.1. Use toMapGeometry instead.
Input Parameters:
|
<Extent> extent |
Required |
The current extent of the map in map coordinates. |
|
<Number> width |
Required |
The current width of the map in screen units. |
|
<Number> height |
Required |
The current width of the map in screen units. |
|
<Point> screenPoint |
Required |
The point to convert from screen to map units. |
esri.geometry.toScreenGeometry(extent, width, height, screenGeometry)
Converts the geometry argument to screen coordinates based on the extent, width, and height of the
Map.
(As of v1.1)
Input Parameters:
|
<Extent> extent |
Required |
The current extent of the map in map coordinates. |
|
<Number> width |
Required |
The current width of the map in screen units. |
|
<Number> height |
Required |
The current width of the map in screen units. |
|
<Geometry> screenGeometry |
Required |
The geometry to convert from map to screen units. |
esri.geometry.toScreenPoint(extent, width, height, mapPoint)
Converts and returns the argument map point in screen coordinates.
Deprecated at v1.1. Use toScreenGeometry instead.
Input Parameters:
|
<Extent> extent |
Required |
The current extent of the map in map coordinates. |
|
<Number> width |
Required |
The current width of the map in screen units. |
|
<Number> height |
Required |
The current width of the map in screen units. |
|
<Point> mapPoint |
Required |
The point to convert from map to screen units. |
esri.geometry.webMercatorToGeographic(geometry)
Converts geometry from Web Mercator units to geographic units. (As of v1.4)
Input Parameters:
|
<Geometry> geometry |
Required |
The geometry to convert. |
Code snippets:
query.geometry = esri.geometry.webMercatorToGeographic(geometries[0]);