require(["esri/geometry/screenUtils"], function(screenUtils) { /* code goes here */ });
Description
(Added at v3.8)
Convert map coordinates to screen coordinates and vice versa.
When coding legacy (non-AMD) style, there is no need to require the module. All methods and properties are available in the namespace. For example,
esri.geometry.toMapGeometry()
.
Samples
Search for
samples that use this class.
Methods
toMapGeometry(extent, width, height, screenGeometry) | Geometry | Converts the geometry argument to map coordinates based on the extent, width, and height of the Map. |
toMapPoint(extent, width, height, screenPoint) | Point | Converts and returns the argument screen point in map coordinates. |
toScreenGeometry(extent, width, height, mapGeometry) | Geometry | Converts the geometry argument to screen coordinates based on the extent, width, and height of the Map. |
toScreenPoint(extent, width, height, mapPoint) | ScreenPoint | Converts and returns the argument map point in screen coordinates. |
Method Details
Converts the geometry argument to map coordinates based on the extent, width, and height of the
Map.
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 height of the map in screen units. |
<Geometry > screenGeometry |
Required |
The geometry to convert from screen to map units. |
Converts and returns the argument screen point in map coordinates.
Deprecated, use toMapGeometry instead. 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 height of the map in screen units. |
<ScreenPoint > screenPoint |
Required |
The screenPoint to convert from screen to map units. At version 3.3, use an instance of ScreenPoint. Prior to 3.3 specify as a Point. |
Converts the geometry argument to screen coordinates based on the extent, width, and height of the
Map.
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 height of the map in screen units. |
<Geometry > mapGeometry |
Required |
The geometry to convert from map to screen units. |
Converts and returns the argument map point in screen coordinates. At version 3.3, the return value is an instance of ScreenPoint. Prior to 3.3 the value will be a Point.
Deprecated at v1.1. Use toScreenGeometry instead. 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 height of the map in screen units. |
<Point > mapPoint |
Required |
The point to convert from map to screen units. |