I'd like to use a basemap containing world map data as a backdrop to some point and outline data that I'm hosting in ArcGIS server in the ESRI Flex API, but I would like the map control to share a WKID with my data, so I don't need to reproject it on every operation. However, the Map control seems to want a) the layers to be displayed with the first being on the bottom, and b) the first layer to be the layer that defines the WKID. Is there a good way to work around these contraints?

  • did this work for you? I get an error on flex 2.2 viewer when using this code – Brad Nesom Aug 4 '11 at 16:26

According to the docs, you can't set SpatialReference directly. Instead, set the extent property on the Map object.

<esri:Map id="map" units="{Units.FEET}">
        <esri:Extent xmin="661140" ymin="-1420246" xmax="3015668" ymax="1594451">
            <esri:SpatialReference wkid="26777"/>
            <!-- NAD_1927_StatePlane_Kansas_North_FIPS_1501 -->
    <esri:ArcGISDynamicMapServiceLayer url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"/>
    <esri:ArcGISDynamicMapServiceLayer url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Petroleum/KGS_OilGasFields_Kansas/MapServer"/>

An alternative way to workaround the (a) and (b) constraints you mention is to re-order the layers once the first layer is loaded (and has set the map spatial reference).

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.