Packagecom.esri.ags.utils
Classpublic class WebMercatorUtil

Projects coordinates between 4326 (GCS_WGS_1984) and 102100 (WGS_1984_Web_Mercator_Auxiliary_Sphere) coordinate systems. Useful when showing Bing Maps (formerly Microsoft Virtual Earth) geocoding results on top of Bing Maps tiled layers because the geocoding is returned in geographic coordinates (4326), while the map layer is in web mercator (102100).

Note: in version 1.2 the ArcGIS API for Flex used 102113 ("WGS_1984_Web_Mercator").


Example
ActionScript usage of geographicToWebMercator:
 myGraphic.geometry = WebMercatorUtil.geographicToWebMercator(veResult.location);
 myMap.extent = WebMercatorUtil.geographicToWebMercator(veResult.bestView) as Extent;

See also

Live sample - Bing Maps geocoder


Public Methods
 MethodDefined by
  
geographicToWebMercator(geometry:Geometry, updateInPlace:Boolean = false):Geometry
[static] Convert a geometry in geographic coordinates to web mercator coordinates, for example the results from Bing Maps geocoding to be able to display them on a Bing Maps map layer.
WebMercatorUtil
  
webMercatorToGeographic(geometry:Geometry, updateInPlace:Boolean = false):Geometry
[static] Convert a geometry in web mercator coordinates to geographic coordinates.
WebMercatorUtil
Method detail
geographicToWebMercator()method
public static function geographicToWebMercator(geometry:Geometry, updateInPlace:Boolean = false):Geometry

Convert a geometry in geographic coordinates to web mercator coordinates, for example the results from Bing Maps geocoding to be able to display them on a Bing Maps map layer. Latitude values must fall within -90 and 90. Longitude values outside +/-180 will be assumed to go around the earth, i.e., -181 will be treated as 179 by Bing Maps.

Parameters
geometry:Geometry — The graphic geometry.
 
updateInPlace:Boolean (default = false) — If true, updates the geometry sent in.

Returns
Geometry
webMercatorToGeographic()method 
public static function webMercatorToGeographic(geometry:Geometry, updateInPlace:Boolean = false):Geometry

Convert a geometry in web mercator coordinates to geographic coordinates.

Parameters
geometry:Geometry — The graphic geometry.
 
updateInPlace:Boolean (default = false) — If true, updates the geometry sent in.

Returns
Geometry