Select to view content in your preferred language

Bing and Sample Flex Viewer (v 1.3)

683
3
05-12-2010 11:28 AM
SusanMordy1
Deactivated User
I have been provided with the following information from our ArcGIS server administrator:

http://servername/pub/vet/jsp/vetoken.jsp

for using Bing in Flex.

The resource center provides the following document for using Bing Maps in Flex:

http://resources.esri.com/help/9.3/arcgisserver/apis/flex/help/index.html#ve_gettingstarted.htm?

In the config.xml file for the sample flex viewer (v 1.3) there is mention of bing:

//uncomment lines below to view virtual earth maps;comment arcgisonline map configuration above (elements: map, basemaps, mapservice)
<!--map initialExtent="-1.3861396457346804E7 2959641.7352047404 -8172035.568026077 6452508.179723226" fullExtent="-1.2836528782099428E7 -4344069.191498438 9920914.775183456 9627396.586575491">
<basemaps menu="menuMap">
      <mapservice label="Road" type="virtualearth" visible="true" style="road" alpha="1" icon="com/esri/solutions/flexviewer/assets/images/icons/i_globe.png">http://[machine]/vetoken.ashx</mapservice>
      <mapservice label="Aerial" type="virtualearth" visible="false" style="aerial" alpha="1" icon="com/esri/solutions/flexviewer/assets/images/icons/i_globe.png">http://[machine]/vetoken.ashx</mapservice>
</basemaps-->


I am not sure what I specifically need to change to the sample flex viewer code (v 1.3) and what specific additional information I will need from my ArcGIS server administrator.

Thanks for you help,

Susan
Tags (2)
0 Kudos
3 Replies
SusanMordy1
Deactivated User
Has anyone got their Bing service working with the SFV 1.3 and could provide an example?

Thanks,

Susan
0 Kudos
GarrettMcBride
Regular Contributor
Please if anyone has any helpful insight to how to get bing to work please email me.  I can't find any real documentation to get this to work.  Everything i have tried has been trial in error with no luck.  The maps do not appear but i still get an x/y coordinate and can still search and locate cities with correct coordinates.  I have to be close.  I commented out the ESRI basemaps and then uncommented out the Bing.  I then exported out a vetoken.ashx and put it in my IIS configured with user name and password that i got via ArcSOM.  When you go directly to the vetoken (http://domain/vetoken.ashx)  it gives a token (ex {"token":"mqc8vRfhMmisbouPhkvibwB6Etl_feVl9J5ET15qsjKzHQ3qqv4PVk4JqNLYq0bx2WgE2XXNnaKX-a8UljHp6w2"} )  which makes me think i am leaving out something small.  Any help would be greatly appreciated.

Thanks,
Garrett McBride

Email: garrett.mcbride@mustangeng.com
0 Kudos
ChrisClose
Emerging Contributor
Please follow these steps to get access to BING maps in the Sample Flex Viewer (SFV) v 1.3 (these instructions assume the SFV is set up in the IIS wwwroot folder):

1. Open the config.xml file and comment out the original map tag. Below is what the code should look like:

  <!--map initialExtent="-122.2 24.89 -70.59 46.92" fullExtent="-150 -50 150 50">
      <basemaps menu="menuMap">              
                  <mapservice label="Street Map" type="tiled" visible="true" alpha="1" icon="com/esri/solutions/flexviewer/assets/images/icons/i_highway.png">http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer</mapservice>
                  <mapservice label="Satellite Map" type="tiled" visible="false" alpha="1" icon="com/esri/solutions/flexviewer/assets/images/icons/i_shuttle.png">http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer</mapservice>                                                  
      </basemaps-->

2.  Uncomment the secondary map tag.  Be sure to comment OUT the first line - the line starts with "//".  Below is what the code should look like:

  <!--//uncomment lines below to view virtual earth maps;comment arcgisonline map configuration above (elements: map, basemaps, mapservice)-->     
      <map initialExtent="-1.3861396457346804E7 2959641.7352047404 -8172035.568026077 6452508.179723226" fullExtent="-1.2836528782099428E7 -4344069.191498438 9920914.775183456 9627396.586575491">    
      <basemaps menu="menuMap">
                <mapservice label="Road" type="virtualearth" visible="true" style="road" alpha="1" icon="com/esri/solutions/flexviewer/assets/images/icons/i_globe.png">http://[machine]/vetoken.ashx</mapservice>
                <mapservice label="Aerial" type="virtualearth" visible="false" style="aerial" alpha="1" icon="com/esri/solutions/flexviewer/assets/images/icons/i_globe.png">http://[machine]/vetoken.ashx</mapservice>
      </basemaps>

3.  At the end of each map service url above, there is a link to the vetoken file.  Change the [machine] in the http://[machine]/vetoken.ashx to match your machine.  For example:

http://yourmachine/vetoken.ashx

4. Save the file.

5. Copy the vetoken.ashx file to your wwwroot dir.  For example: "C:\Inetpub\wwwroot" 

Notes:
- If this file in any other folder, you will not be able to access BING maps
- To get a copy of this file, see Step 2 in the help: http://resources.esri.com/help/9.3/arcgisserver/apis/flex/help/index.html

6. Edit the vetoken.ashx to add your username and password and your host machine.  The following areas need changed: "your username", "your password", and "yourmachine" as illustrated below:

    // set your VE credentials
    private string userName = "your username";
    private string password = "your password";

    // set your allowed referers
    // For ex.: "http://www.esri.com/myapp/"

    private string[] refererURLs = {
                                     "http://yourmachine",
                                     //"http://[replace]",
                                   };   

7. Save the file
8. Open a browser and test app.
0 Kudos