Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/workers
Object: esri/geometry/screenUtils

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

NameReturn typeSummary
toMapGeometry(extent, width, height, screenGeometry)GeometryConverts the geometry argument to map coordinates based on the extent, width, and height of the Map.
toMapPoint(extent, width, height, screenPoint)PointConverts and returns the argument screen point in map coordinates.
toScreenGeometry(extent, width, height, mapGeometry)GeometryConverts the geometry argument to screen coordinates based on the extent, width, and height of the Map.
toScreenPoint(extent, width, height, mapPoint)ScreenPointConverts and returns the argument map point in screen coordinates.
Method Details

toMapGeometry(extent, width, height, screenGeometry)

Converts the geometry argument to map coordinates based on the extent, width, and height of the Map.
Return type: Geometry
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.

toMapPoint(extent, width, height, screenPoint)

Converts and returns the argument screen point in map coordinates. Deprecated, use toMapGeometry instead.
Return type: Point
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.

toScreenGeometry(extent, width, height, mapGeometry)

Converts the geometry argument to screen coordinates based on the extent, width, and height of the Map.
Return type: Geometry
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.

toScreenPoint(extent, width, height, mapPoint)

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.
Return type: ScreenPoint
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.