Select to view content in your preferred language

Include Overview Map in Snapshot Image

2799
36
06-03-2010 09:19 AM
StuartBlumberg
Emerging Contributor
I am using a "snapshot" button in order to export the current extent as a JPEG.  How would I include an overview map in a corner of the JPEG snapshot showing where in the city the snapshot is showing?  I am using the Flex Sample Viewer.  I am using the following code to create the snapshot:

private function clickHandler() : void   
   {       
   var map:Map = SiteContainer.getInstance().controller.map;
   const decoder: JPEGEncoder = new JPEGEncoder();       
   map.logoVisible=false;       
   map.scaleBarVisible=true;
   map.zoomSliderVisible = false;
   SiteContainer.getInstance().mapManager.control.visible = false;
  
               //get the current background color of the map
               var currentMapColor:Object = map.getStyle("backgroundColor");
               //set the background color to white
               map.setStyle("backgroundColor", "#CCCCCC");  
               //validate the changes                        
               map.validateNow();      
   const imageSnapshot:ImageSnapshot =
  ImageSnapshot.captureImage(map);       
   map.logoVisible=true;       
   map.scaleBarVisible=true;       
   map.zoomSliderVisible = true;
   map.setStyle("backgroundColor", currentMapColor);
               //validate the changes            
               map.validateNow();     
   const fileReference:FileReference = new
  FileReference();       
   fileReference.save
  (imageSnapshot.data,"map.jpg");
Tags (2)
0 Kudos
36 Replies
ErwanCaradec
Emerging Contributor
Karl,
here is a beta version of the SnapshotWidget, now it can create a zip file including the image and geolocation file (worldfile .jgw). The jpeg file can be imported in arcmap using the same coordinate system as the FlewViewer map.
I'm a noob widget developper so if some users could test it before publishing a release version it would be fine. I'm also a poor english speaker so if default labels should be modified, comments woul'd be appreciated.
Actually in ArcGIS Explorer i've got some problems to load the jpg file, i need time or idea to solve the problem.

Erwan

View in live : http://erwan.caradec.pagesperso-orange.fr/flexViewer/index.html?config=configs/tests/config.xml
0 Kudos
MelissaJohnson
Frequent Contributor
Very nice tool.

I am trying to find a way to add a third option to Copy to Clipboard to this widget so that if someone just wants to copy/paste the image into an email or word doc they could do that without having to save to their drive.  I am having problems finding the right command for copying to clipboard.  Does anyone know how this could be done?  I have added  the button and created a function copySnapshot using the saveSnapshot function but I don't know how I can do a Copy instead of Save.  I tried using setClipboard (then found out that could only be used in AIR). 

Pretty new to this so fumbling through it.  If anyone has any ideas or can tell me where to look for info it would be appreciated.
Melissa
0 Kudos
ErwanCaradec
Emerging Contributor
Hi Melissa,
i've tried to implement this function too but i've read that clipboard can be accessed in air to copy/past text and binary data. Web browser can only past texte data in clip board due to security problems.

regards.

Erwan
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Mellisa,

   FlashPlayer can not copy images to the clipboard like AIR can as this could be a huge security hole manipulated by hackers. Flash Player can only do text to the clipboard.


Same as Erwan posted a minute earlier 🙂
0 Kudos
MelissaJohnson
Frequent Contributor
Thanks!  I can quit banging my head against the wall now 🙂
0 Kudos
KarlWilson
Frequent Contributor
Hi Erwan,

Your SnapshotWidget is really good. I've only tried the basic functionality (i.e. not the geolocation file download), but it seems to work well. You should definately release it once you're happy with it.

The labels are fine, but you may want to refer to the image selection as the "map area", rather than the "map zone".

Cheers,
Karl
0 Kudos
ErwanCaradec
Emerging Contributor
Thanks for your reply Karl, i'm going to release it with your label modification suggestion. It seems that the coordinate system problem in ArcGIS Explorer is independant to the jgw file generation in the widget.

Regards.

Erwan

Edit : Release done with auto resize addition
0 Kudos