Method Overview
| Name | Return Type | Summary | |
|---|---|---|---|
| Boolean | Returns | more details | |
| Geometry | Converts a geometry from geographic units (wkid: 4326) to Web Mercator units (wkid: 3857). more details | more details | |
| Number[] | Translates the given latitude and longitude (decimal degree) values to Web Mercator XY values. more details | more details | |
| Geometry | Projects the geometry clientside (if possible). more details | more details | |
| Geometry | Converts a geometry from Web Mercator units (wkid: 3857) to geographic units (wkid: 4326). more details | more details | |
| Number[] | Translates the given Web Mercator coordinates to Longitude and Latitude values (decimal degrees). more details | more details | |
Method Details
canProject(source, target){Boolean}
Returns
trueif thesourcespatial reference can be projected to thetargetspatial reference with the project() function, or if thesourceandtargetare the same SpatialReference.Parameters:source SpatialReference | ObjectThe input SpatialReference or an object with
spatialReferenceproperty such as Geometry or Map.target SpatialReference | ObjectThe target SpatialReference or an object with
spatialReferenceproperty such as Geometry or Map.Returns:Type Description Boolean Returns trueifsourcecan be projected totarget.- See also:
geographicToWebMercator(geometry){Geometry}
Converts a geometry from geographic units (wkid: 4326) to Web Mercator units (wkid: 3857).
Parameter:geometry GeometryThe input geometry to convert.
Returns:Type Description Geometry Returns the converted geometry in Web Mercator units. lngLatToXY(long, lat){Number[]}
Translates the given latitude and longitude (decimal degree) values to Web Mercator XY values.
Parameters:long NumberThe longitude value to convert.
lat NumberThe latitude value to convert.
Returns:Type 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.Parameters:geometry GeometryThe input geometry.
spatialReference SpatialReference | ObjectThe target SpatialReference or an object with
spatialReferenceproperty such as Geometry or Map.Returns:Type Description Geometry Returns the projected geometry if the projection is successful. webMercatorToGeographic(geometry){Geometry}
Converts a geometry from Web Mercator units (wkid: 3857) to geographic units (wkid: 4326).
Parameter:geometry GeometryThe input geometry to convert.
Returns:Type Description Geometry Returns the converted geometry in geographic units. xyToLngLat(x, y){Number[]}
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.
Parameters:x NumberThe X coordinate value to convert.
y NumberThe Y coordinate value to convert.
Returns:Type Description Number[] Returns the converted values in an array.