I am using the up-to-date flex api and esri api for flex. I know how to use flex to obtain a snapshot of a map, but ultimately what I want to do is retrieve a scaled up image of a part of the basemap. Are there any tools in the flex api that I could use to modify the extent and scale of a map object and store the result maybe as a clone? I've tried changing the extent, but it ultimately changes the basemap which is not what I want to do. I simply want to select a part of the basemap using extent coordinates and then retrieve only what is within those coordinates.

I want to be able to get this image and I understand that the tiles will need to wait to be cached. So I can probably write a conditional check for that.


You can apply a mask to the layer, and then export the masked Layer to a BitmapData, or Bitmap if required.

Have a look at this article: Masking display objects The Only major change you'll have to do, is to convert your required extent from map units to display units, and then use it to mask the Layer.

Once you have masked the layer, you can convert it to BitmapData, using a function such as:

static public function getLayerAsBitmap(fromTarget:UIComponent, area:Rectangle = null):BitmapData
var bd : BitmapData = new BitmapData( _map.width, _map.height, true, 0x00000000 );
bd.draw( fromTarget, m );
return bd;

Another way of solving this issue, is to call the ExportMapImage on the DynamicMapService. Even though most BaseMaps will be tiled map services, you can still call them as Dynamic Map service.

Once you have the Image, you can do whatever you need with it.

  • how do you go about changing the extents from map units to display units? – Carl Carlson Apr 12 '13 at 16:47
  • what exactly is a screen point? Also, for some reason it seems toScreenX or toScreenY doesn't show up as an option when I use my map object despite my flex version being the most up to date. – Carl Carlson Apr 15 '13 at 15:06
  • also I'm not sure the masking display objects will work as I want to retrieve the full cropped image, and not so much provide a cutout graphic in which I can specify a particular color. – Carl Carlson Apr 15 '13 at 19:03
  • The basemap here is not necessarily a tiled map service, it is an ArcGIS map object which could possibly entail any layer type, so I have to adjust to catch any kind and export them. – Carl Carlson Apr 15 '13 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.