Packagecom.esri.aws.awx.map
Classpublic class Map
InheritanceMap Inheritance mx.containers.Canvas
Implementscom.esri.aws.osgi.framework.IBundleActivator, IMap

Map is the main mapping component of the ArcWeb Explorer v4 API.

The Map is composed of layers, which can either be overlays, such as markers or lines and basemap layers. Basemap layers can be placed in the basemaps property, then accessed by setting the mapType property. By default, the Map comes with six default basemaps (street, satellite, hybrid, tiled streets, topographic and shaded relief) and three default overlay layers (markers, polygons and polylines). These defaults can be overridden by setting the createDefaultLayers to false or by setting the basemaps with your own basemaps. User interaction with the map can be customized using the keyboardHandler and mouseHandler properties.

Default MXML Propertylayers

View the examples.

See also

Getting started with ArcWeb Explorer Flex API
Live Sample - Show Map - Flex API
Live Sample - Show Map - JavaScript to Flex Bridge
com.esri.aws.awx.events.MapChangeEvent
com.esri.aws.awx.events.MapTypeChangeEvent


Public Properties
 PropertyDefined by
  basemaps : IGroupLayer
The basemaps property can be used to define a collection of basemaps that can be easily manipulated by the mapType property.
Map
  center : GeoPoint
The geographic center of the map.
Map
  centerGeoX : Number
The map center longitude.
Map
  centerGeoY : Number
The map center latitude.
Map
  createDefaultLayers : Boolean
If true, default basemaps and overlay layers will be created at startup.
Map
  editable : Boolean
[read-only] If true, the group layer is editable so all of the manipulation methods with throw an error.
Map
  extent : Extent
The bounding box (minX, minY, maxX, maxY) of the current map.
Map
  keyboardHandler : IKeyboardHandler
The keyboard handler that should handle all keyboard interactions with the map.
Map
  layers : Array
The array of layers.
Map
  map : IMap
[read-only] The reference to the parent map container.
Map
  mapHeight : Number
The map height in pixels.
Map
  mapRotation : Number
The rotation of the map.
Map
  mapType : String

The default valid values in MXML (assuming you haven't redefined the basemaps) are streets, aerial, hybrid, streetTiles, shadedRelief, topographic, none.

In ActionScript, you use the following constants to set this property: Map.STREETS, Map.AERIAL, Map.HYBRID, Map.STREET_TILES, Map.SHADED_RELIEF, Map.TOPOGRAPHIC, Map.NONE

Map
  mapWidth : Number
The map width in pixels.
Map
  markerLayer : OverlayLayer
[read-only] The marker layer.
Map
  maxScale : Number
The maximum allowed scale.
Map
  minScale : Number
The minimum allowed scale.
Map
  mouseHandler : IMouseHandler
The mouse handler that should handle all mouse interactions with the map.
Map
  numLayers : int
[read-only] The number of layers.
Map
  polygonLayer : OverlayLayer
[read-only] The polygon layer.
Map
  polylineLayer : OverlayLayer
[read-only] The polyline layer.
Map
  projectionID : int
The current projectionID of the map.
Map
  rotatedHeight : Number
The rotated map height in pixels.
Map
  rotatedWidth : Number
The rotated map width in pixels.
Map
  scale : Number
The current scale of the map.
Map
  showCrosshair : Boolean
If true, shows the crosshair at the center of the map.
Map
  showLogo : Boolean
If true, shows the ESRI logo at the corner of the map.
Map
  showScaleBar : Boolean
If true, shows the scale bar at the corner of the map.
Map
  staticLayer : IStaticLayer
[read-only] The main Static Layer (an IStaticLayer) onto which Static objects can be placed.
Map
  supportedProjections : Array
[write-only] The array of supported projections for the groupLayer(s) in this map.
Map
Public Methods
 MethodDefined by
  
Map()
Creates a new Map.
Map
  
addLayer(layer:ILayer):void
Adds a layer to the group layer.
Map
  
Returns a scale to ensure that an entire extent is visible.
Map
  
Converts decimal degree values to pixel.
Map
  
Converts pixel values to decimal degrees.
Map
  
Gets a layer based on its identifier.
Map
  
moveLayerAbove(layer1ID:String, layer2ID:String):void
Moves the first layer above the the second layer in the z-order.
Map
  
moveLayerBelow(layer1ID:String, layer2ID:String):void
Moves the first layer below the the second layer in the z-order.
Map
  
moveLayerToBottom(layerID:String):void
Moves the layer to the bottom of the z-order.
Map
  
moveLayerToTop(layerID:String):void
Moves the layer to the top of the z-order.
Map
  
Removes all layers.
Map
  
removeLayer(layerID:String):void
Removes a layer.
Map
  
showWorld():void
Adjusts the map extent to show the whole world.
Map
  
swapLayers(layer1ID:String, layer2ID:String):void
Swaps the z-order of two layers.
Map
Events
 EventSummaryDefined by
   Dispatched after a child has been added to a container.Map
   Dispatched before a child of a container is removed.Map
   A layer has been moved within a GroupLayer.Map
   Used to detect when the map model has been changed.Map
   Used to detect when the mapType has been changed.Map
   The map is starting to pan.Map
   The map is finished panning.Map
Public Constants
 ConstantDefined by
  AERIAL : String = "aerial"
[static] Satellite map type.
Map
  HYBRID : String = "hybrid"
[static] Hybrid map type.
Map
  NONE : String = "none"
[static] No map type.
Map
  SHADED_RELIEF : String = "shadedRelief"
[static] Satellite map type.
Map
  STREETS : String = "streets"
[static] Street map type.
Map
  STREET_TILES : String = "streetTiles"
[static] StreetTiles map type.
Map
  TOPOGRAPHIC : String = "topographic"
[static] Topographic map type.
Map
Property detail
basemapsproperty
basemaps:IGroupLayer  [read-write]

The basemaps property can be used to define a collection of basemaps that can be easily manipulated by the mapType property.

Note that basemaps implements IGroupLayer so all of its properties and methods are available to basemaps (even though intellisense might not list them).

Implementation
    public function get basemaps():IGroupLayer
    public function set basemaps(value:IGroupLayer):void

See also

mapType
IGroupLayer
centerproperty 
public var center:GeoPoint

The geographic center of the map.

This property can be used as the source for data binding.

centerGeoXproperty 
public var centerGeoX:Number

The map center longitude.

The default value is 0.0.

This property can be used as the source for data binding.

centerGeoYproperty 
public var centerGeoY:Number

The map center latitude.

The default value is 0.0.

This property can be used as the source for data binding.

createDefaultLayersproperty 
createDefaultLayers:Boolean  [read-write]

If true, default basemaps and overlay layers will be created at startup. If basemaps is defined, only the default overlay layers will be created. The default overlay layers are one polygon layer, one polyline layer, and one marker layer.

The default value is true.

Implementation
    public function get createDefaultLayers():Boolean
    public function set createDefaultLayers(value:Boolean):void
editableproperty 
editable:Boolean  [read-only]

If true, the group layer is editable so all of the manipulation methods with throw an error.

The default value is true.

Implementation
    public function get editable():Boolean
extentproperty 
public var extent:Extent

The bounding box (minX, minY, maxX, maxY) of the current map.

This property can be used as the source for data binding.

keyboardHandlerproperty 
keyboardHandler:IKeyboardHandler  [read-write]

The keyboard handler that should handle all keyboard interactions with the map.

Implementation
    public function get keyboardHandler():IKeyboardHandler
    public function set keyboardHandler(value:IKeyboardHandler):void
layersproperty 
layers:Array  [read-write]

The array of layers.

Implementation
    public function get layers():Array
    public function set layers(value:Array):void
mapproperty 
map:IMap  [read-only]

The reference to the parent map container.

Implementation
    public function get map():IMap
mapHeightproperty 
mapHeight:Number  [read-write]

The map height in pixels.

Implementation
    public function get mapHeight():Number
    public function set mapHeight(value:Number):void
mapRotationproperty 
public var mapRotation:Number

The rotation of the map.

The default value is 0.0.

This property can be used as the source for data binding.

mapTypeproperty 
public var mapType:String

The default valid values in MXML (assuming you haven't redefined the basemaps) are streets, aerial, hybrid, streetTiles, shadedRelief, topographic, none.

In ActionScript, you use the following constants to set this property: Map.STREETS, Map.AERIAL, Map.HYBRID, Map.STREET_TILES, Map.SHADED_RELIEF, Map.TOPOGRAPHIC, Map.NONE

The name of the map type.

This property can be used as the source for data binding.

mapWidthproperty 
mapWidth:Number  [read-write]

The map width in pixels.

Implementation
    public function get mapWidth():Number
    public function set mapWidth(value:Number):void
markerLayerproperty 
markerLayer:OverlayLayer  [read-only]

The marker layer.

Implementation
    public function get markerLayer():OverlayLayer
maxScaleproperty 
maxScale:Number  [read-write]

The maximum allowed scale. Only used if greater than 1.0.

The default value is 0.0.

Implementation
    public function get maxScale():Number
    public function set maxScale(value:Number):void
minScaleproperty 
minScale:Number  [read-write]

The minimum allowed scale. Can not be lower than 1.0.

The default value is 1.0.

Implementation
    public function get minScale():Number
    public function set minScale(value:Number):void
mouseHandlerproperty 
mouseHandler:IMouseHandler  [read-write]

The mouse handler that should handle all mouse interactions with the map.

Implementation
    public function get mouseHandler():IMouseHandler
    public function set mouseHandler(value:IMouseHandler):void
numLayersproperty 
numLayers:int  [read-only]

The number of layers.

Implementation
    public function get numLayers():int
polygonLayerproperty 
polygonLayer:OverlayLayer  [read-only]

The polygon layer.

Implementation
    public function get polygonLayer():OverlayLayer
polylineLayerproperty 
polylineLayer:OverlayLayer  [read-only]

The polyline layer.

Implementation
    public function get polylineLayer():OverlayLayer
privateStaticLayerproperty 
privateStaticLayer:IStaticLayer  [read-only]Implementation
    awx_internal function get privateStaticLayer():IStaticLayer
projectionIDproperty 
public var projectionID:int

The current projectionID of the map.

The default value is -1 .

This property can be used as the source for data binding.

rotatedHeightproperty 
rotatedHeight:Number  [read-write]

The rotated map height in pixels.

This property can be used as the source for data binding.

Implementation
    public function get rotatedHeight():Number
    public function set rotatedHeight(value:Number):void
rotatedWidthproperty 
rotatedWidth:Number  [read-write]

The rotated map width in pixels.

This property can be used as the source for data binding.

Implementation
    public function get rotatedWidth():Number
    public function set rotatedWidth(value:Number):void
scaleproperty 
public var scale:Number

The current scale of the map.

The default value is NaN.

This property can be used as the source for data binding.

showCrosshairproperty 
public var showCrosshair:Boolean

If true, shows the crosshair at the center of the map.

The default value is true.

This property can be used as the source for data binding.

showLogoproperty 
public var showLogo:Boolean

If true, shows the ESRI logo at the corner of the map.

The default value is true.

This property can be used as the source for data binding.

showScaleBarproperty 
public var showScaleBar:Boolean

If true, shows the scale bar at the corner of the map.

The default value is true.

This property can be used as the source for data binding.

staticLayerproperty 
staticLayer:IStaticLayer  [read-only]

The main Static Layer (an IStaticLayer) onto which Static objects can be placed.

Implementation
    public function get staticLayer():IStaticLayer
supportedProjectionsproperty 
supportedProjections:Array  [write-only]

The array of supported projections for the groupLayer(s) in this map. Note that different group layers support different projections. This function returns the common set of projections for the current map.

This property can be used as the source for data binding.

Implementation
    public function set supportedProjections(value:Array):void
Constructor detail
Map()constructor
public function Map()

Creates a new Map. The map model is initialized with the following values:

Method detail
addLayer()method
public function addLayer(layer:ILayer):void

Adds a layer to the group layer.

Parameters
layer:ILayer — the layer to add.
convertExtentToScale()method 
public function convertExtentToScale(extent:Extent):Number

Returns a scale to ensure that an entire extent is visible.

Parameters
extent:Extent — the extent to get a scale for.

Returns
Number — The scale factor.
convertGeoPointToPoint()method 
public function convertGeoPointToPoint(geoPoint:GeoPoint):Point

Converts decimal degree values to pixel.

Parameters
geoPoint:GeoPoint — the lat/lon values to convert.

Returns
Point — pixel values of provided lat/lon.
convertPointToGeoPoint()method 
public function convertPointToGeoPoint(point:Point):GeoPoint

Converts pixel values to decimal degrees.

Parameters
point:Point — the pixel point to convert.

Returns
GeoPoint — lat/lon values of provided pixel point.
getLayer()method 
public function getLayer(layerID:String):ILayer

Gets a layer based on its identifier.

Parameters
layerID:String — the layer identifier.

Returns
ILayer
moveLayerAbove()method 
public function moveLayerAbove(layer1ID:String, layer2ID:String):void

Moves the first layer above the the second layer in the z-order.

Parameters
layer1ID:String — the layer to move.
 
layer2ID:String — the layer to be moved above.
moveLayerBelow()method 
public function moveLayerBelow(layer1ID:String, layer2ID:String):void

Moves the first layer below the the second layer in the z-order.

Parameters
layer1ID:String — the layer to move.
 
layer2ID:String — the layer to be moved below.
moveLayerToBottom()method 
public function moveLayerToBottom(layerID:String):void

Moves the layer to the bottom of the z-order.

Parameters
layerID:String — the layer to move.
moveLayerToTop()method 
public function moveLayerToTop(layerID:String):void

Moves the layer to the top of the z-order.

Parameters
layerID:String — the layer to move.
removeAllLayers()method 
public function removeAllLayers():void

Removes all layers.

removeLayer()method 
public function removeLayer(layerID:String):void

Removes a layer.

Parameters
layerID:String — the layer to remove.
showWorld()method 
public function showWorld():void

Adjusts the map extent to show the whole world.

swapLayers()method 
public function swapLayers(layer1ID:String, layer2ID:String):void

Swaps the z-order of two layers.

Parameters
layer1ID:String — the first layer to swap.
 
layer2ID:String — the second layer to swap.
Event detail
childAddevent 
Event object type: mx.events.ChildExistenceChangedEvent

Dispatched after a child has been added to a container.

The childAdd event is dispatched when the addChild() or addChildAt() method is called. When a container is first created, the addChild() method is automatically called for each child component declared in the MXML file. The addChildAt() method is automatically called whenever a Repeater object adds or removes child objects. The application developer may also manually call these methods to add new children.

At the time when this event is sent, the child object has been initialized, but its width and height have not yet been calculated, and the child has not been drawn on the screen. If you want to be notified when the child has been fully initialized and rendered, then register as a listener for the child's creationComplete event.

childRemoveevent  
Event object type: mx.events.ChildExistenceChangedEvent

Dispatched before a child of a container is removed.

This event is delivered when any of the following methods are called: removeChild(), removeChildAt(), or removeAllChildren().

groupLayerChangeevent  
Event object type: com.esri.aws.awx.events.GroupLayerEvent
GroupLayerEvent.type property = com.esri.aws.awx.events.GroupLayerEvent.GROUPLAYER_CHANGE

A layer has been moved within a GroupLayer.

mapChangeevent  
Event object type: com.esri.aws.awx.events.MapChangeEvent
MapChangeEvent.type property = com.esri.aws.awx.events.MapChangeEvent.MAP_CHANGE

Used to detect when the map model has been changed.

mapTypeChangeevent  
Event object type: com.esri.aws.awx.events.MapTypeChangeEvent
MapTypeChangeEvent.type property = com.esri.aws.awx.events.MapTypeChangeEvent.MAP_TYPE_CHANGE

Used to detect when the mapType has been changed.

panStartevent  
Event object type: com.esri.aws.awx.events.PanEvent
PanEvent.type property = com.esri.aws.awx.events.PanEvent.PAN_START

The map is starting to pan.

panStopevent  
Event object type: com.esri.aws.awx.events.PanEvent
PanEvent.type property = com.esri.aws.awx.events.PanEvent.PAN_STOP

The map is finished panning.

Constant detail
AERIALconstant
public static const AERIAL:String = "aerial"

Satellite map type.

HYBRIDconstant 
public static const HYBRID:String = "hybrid"

Hybrid map type.

NONEconstant 
public static const NONE:String = "none"

No map type. Overwrites the default pre-populated map type.

SHADED_RELIEFconstant 
public static const SHADED_RELIEF:String = "shadedRelief"

Satellite map type.

STREETSconstant 
public static const STREETS:String = "streets"

Street map type.

STREET_TILESconstant 
public static const STREET_TILES:String = "streetTiles"

StreetTiles map type.

TOPOGRAPHICconstant 
public static const TOPOGRAPHIC:String = "topographic"

Topographic map type.

Examples
SimpleMapTypes
<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:awx="http://www.arcwebservices.com/2007/awx"
    layout="absolute">
    
    <awx:Framework apiKey="[Your API Key here]"/>
    
    <awx:Map mapType="streets">
        <awx:basemaps>
            <awx:VectorGroupLayer id="streets"/>
        </awx:basemaps>
    </awx:Map>
    
</mx:Application>
ScaleAndCenter
<?xml version="1.0" encoding="utf-8"?>
<!-- Open map at specific location and scale-->
<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:awx="http://www.arcwebservices.com/2007/awx">
    <awx:Framework apiKey="[Your API Key here]"/>
    <awx:Map id="m_map" height="100%" width="100%" centerGeoY="33" centerGeoX="-117" scale="20000000"/>
</mx:Application>
RasterTiles
<?xml version="1.0" encoding="utf-8"?>
<!-- 'Raster Tiles' sample for ArcWeb Services Flex API -->
<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:awx="http://www.arcwebservices.com/2007/awx">

    <awx:Framework apiKey="[Your API Key here]"/>
    <awx:Map mapType="physicalTiles" id="m_map" height="100%" width="70%" centerGeoY="33" centerGeoX="-117" scale="20000000">
        <awx:basemaps>
            <awx:RasterTileLayer id="physicalTiles" dataSource="ArcWeb:ESRI.Physical_Tiles.World"/>
        </awx:basemaps>
    </awx:Map>
</mx:Application>