Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
Boolean | Returns | webMercatorUtils | |
Geometry | Converts a geometry from geographic units (wkid: 4326) to Web Mercator units (wkid: 3857). more details | webMercatorUtils | |
Number[] | Translates the given latitude and longitude (decimal degree) values to Web Mercator XY values. more details | webMercatorUtils | |
Geometry | Projects the geometry clientside (if possible). more details | webMercatorUtils | |
Geometry | Converts a geometry from Web Mercator units (wkid: 3857) to geographic units (wkid: 4326). more details | webMercatorUtils | |
Number[] | Translates the given Web Mercator coordinates to Longitude and Latitude values (decimal degrees). more details | webMercatorUtils |
Method Details
-
canProject(source, target){Boolean}
-
Returns
true
if thesource
spatial reference can be projected to thetarget
spatial reference with the project() function, or if thesource
andtarget
are the same SpatialReference.Parameterssource SpatialReference|ObjectThe input SpatialReference or an object with
spatialReference
property such as Geometry or Map.target SpatialReference|ObjectThe target SpatialReference or an object with
spatialReference
property such as Geometry or Map.ReturnsType Description Boolean Returns true
ifsource
can be projected totarget
.- See also
-
geographicToWebMercator(geometry){Geometry}
-
Converts a geometry from geographic units (wkid: 4326) to Web Mercator units (wkid: 3857).
Parametergeometry GeometryThe input geometry to convert.
ReturnsType Description Geometry Returns the converted geometry in Web Mercator units.
-
Translates the given latitude and longitude (decimal degree) values to Web Mercator XY values.
Parameterslong NumberThe longitude value to convert.
lat NumberThe latitude value to convert.
ReturnsType Description Number[] Returns the converted values in an array.
-
project(geometry, spatialReference){Geometry}
-
Projects the geometry clientside (if possible). You should test the input geometry in canProject() prior to using this function. If the result of canProject() is
true
, then proceed to project. If canProject() returnsfalse
, thenproject()
won't return useful results. Use geometryService.project() instead.Parametersgeometry GeometryThe input geometry.
spatialReference SpatialReference|ObjectThe target SpatialReference or an object with
spatialReference
property such as Geometry or Map.ReturnsType Description Geometry Returns the projected geometry if the projection is successful.
-
webMercatorToGeographic(geometry, isLinear){Geometry}
-
Converts a geometry from Web Mercator units (wkid: 3857) to geographic units (wkid: 4326).
Parametersgeometry GeometryThe input geometry to convert.
isLinear BooleanoptionalDefault Value: falseIndicates whether to work with linear values, i.e., do not normalize. By default, this conversion method normalizes xmin and xmax values. If this is not desired, specify this value as
true
. Default value isfalse
.ReturnsType Description Geometry Returns the converted geometry in geographic units.
-
Translates the given Web Mercator coordinates to Longitude and Latitude values (decimal degrees). By default the returned longitude is normalized so that it is within -180 and +180.
Parametersx NumberThe X coordinate value to convert.
y NumberThe Y coordinate value to convert.
ReturnsType Description Number[] Returns the converted values in an array.