We want to include a base map layer in hosted Flex app. We requested web map service from the vendor and I got a file (.htm) from client with some dojo code. I can understand the code but I am not sure how can I include this in my flex app configuration:

    // info used to create web tile layers
    var mapurl  = "http://bnvnbvnn/${0}/${2}/${1}.png"
    var lyr = new esri.layers.WebTileLayer(mapurl);
    // clear out the side bar
    //dojo.byId("leftPane").innerHTML = "";
    // create and add the layers
    //var layerDiv = dojo.create("div");


If I will replace variables on URL, I can see images but how will I use this for Flex configuration- where it comes like this:

 <layer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" 
visible="true" type="tiled" label="ArcGIS Streets"/>

I have never worked with Dojo toolkit, so I have no idea (or may be there is some communication gap)


  • Your best bet is to start with the ESRI Resource Center. resources.arcgis.com/en/communities/flex-api – Craig Dec 6 '12 at 17:46
  • To me, that URL has the markings of an OpenStreetMap (OSM) tile/format deployment, and if so, I believe you can consume it without a struggle in the ESRI Flex-viewer using their OpenStreetMapLayer class. I posted an example that I suspect will nearly copy..paste right into your app. – elrobis Dec 24 '12 at 17:09

@user8732, the url in the vendor-provided dojo stuff implies an OpenStreetMap-themed tile distribution, which leaves me thinking you can implement it using ESRI Flex-viewer's built-in OpenStreetMapLayer class.

ESRI provides an example complete with source, and If I adapt that example based on what's explained in the OpenStreetMapLayer API, I'd get the code you find below.

<esri:Map logoVisible="false"

The repetition you find in the server addresses, above, is necessary to resolve a JavaScript limitation. I'm not aware if this issue affects Flex, and the code I proposed assumes it does not affect Flex (hence three of the exact same server paths). However, if you find this is an issue in Flex and you want to resolve it the JavaScript way, you can create 3 DNS addresses that all point to the same host; i.e. http://a.bnvnbvnn/, http://b.bnvnbvnn, and http://c.bnvnbvnn.

BostonGIS explains this in point #3 as follows (realize they are talking aboug JavaScript, specifically, but on a high-level it relates to your Flex implementation, too):

NOTE: We have an array of 3 tile urls. For our case, this is pretty useless, but for load balancing purposes and to also get rid of javascripts limitations of calling a server x amount of times in any period, you may want to setup more than one tile server or mask your single tile server with multiple dns names (to fool javscript).

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.