Select to view content in your preferred language

Load Bing Map & Google Maps

647
4
Jump to solution
04-11-2013 07:03 AM
ShaningYu
Honored Contributor
I borrowed a piece of code to load Bing and Google maps.  The related piece of code is below.  However, neither google map or Bing map displays on the browser.  I am not sure whether I should have token/key for Bing/google map.  If yes, where should code to include the token/key?  Thanks.


------------
   public var mapClickHandler:Function;
  
   public function bing_clickHandler():void {
    mapClickHandler = generateLinkHandler(WebMapLinkEvent.BING);
    map.addEventListener(MapMouseEvent.MAP_CLICK, mapClickHandler);
   }
  
   public function google_clickHandler():void {
    mapClickHandler = generateLinkHandler(WebMapLinkEvent.GOOGLE);
    map.addEventListener(MapMouseEvent.MAP_CLICK, mapClickHandler);
   }
  
   private function generateLinkHandler(linkType:String):Function {
    return function (event:MapMouseEvent):void {
     var point:MapPoint = event.mapPoint;
     var link:WebMapLinkEvent = new WebMapLinkEvent()
     link.point = point;
     link.mapType = linkType;
     CentralDispatcher.dispatchEvent(link);
    }
   }
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
BjornSvensson
Esri Regular Contributor
<bing key="YOURBINGKEY"/> ... <layer label="Streets" type="bing" visible="false" style="road" culture="en-US" /> <layer label="Aerial" type="bing" visible="true" style="aerial" culture="en-US" /> <layer label="Aerial with labels" type="bing" visible="false" style="aerialWithLabels" culture="en-US" />

View solution in original post

0 Kudos
4 Replies
BjornSvensson
Esri Regular Contributor
I borrowed a piece of code to load Bing and Google maps.  The related piece of code is below.


Your "related piece of code" is missing a lot of code, but that doesn't matter. Also, I don't think this google option is legal.

The good news is that the API and the Viewer already supports Bing Maps.  You can just add them as layers in the main config.xml file.  No need to do any custom coding.
http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/WMS_WMTS_ArcIMS_WebTiled_and_Bi...
0 Kudos
ShaningYu
Honored Contributor
BJorn:  Thanks for your response.  I checked the link you provided, but could not figure out How To Do?  Per my understanding, I should add something in the config.  I will appreciate if you can provide a sample code for it.  Thanks.
0 Kudos
BjornSvensson
Esri Regular Contributor
<bing key="YOURBINGKEY"/> ... <layer label="Streets" type="bing" visible="false" style="road" culture="en-US" /> <layer label="Aerial" type="bing" visible="true" style="aerial" culture="en-US" /> <layer label="Aerial with labels" type="bing" visible="false" style="aerialWithLabels" culture="en-US" />
0 Kudos
ShaningYu
Honored Contributor
Got it.  Thanks.
0 Kudos