Using ArcGISImageServiceLayer as a basmaplayer

844
1
10-19-2011 10:23 AM
NatCarter
New Contributor III
I can add an ArcGISImageServiceLayer with a different spatialReference than the initially set extent and other layers in the map such as the one from ESRI (http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer).  When I try to use the same Imageserver layer as a new.dijit.BasemapLayer it does not reproject correctly as when adding it by just using the usual map.addLayer function.

I have tried it two different versions of this but neither works.

Version #1
var NAIP2009params = new esri.layers.ImageServiceParameters();
    NAIP2009params.noData = 0;
    var islNAIP2009 = new esri.layers.ArcGISImageServiceLayer("http://gisservice.mt.gov/ArcGIS/rest/services/MSDI_Framework/NAIP_2009/ImageServer", {
        imageServiceParameters: NAIP2009params
    });

    var basemapNAIP2009 = new esri.dijit.Basemap({
        layers: [islNAIP2009],
        id: "bmNAIP2009",
        title: "NAIP 2009"
    });
    basemaps.push(basemapNAIP2009);

Version #2
    var basemapNAIP2009 = new esri.dijit.Basemap({
        layers: [new esri.dijit.BasemapLayer({
            url: "http://gisservice.mt.gov/ArcGIS/rest/services/MSDI_Framework/NAIP_2009/ImageServer"
        })],
        id: "bmNAIP2009",
        title: "NAIP 2009"
    });
    basemaps.push(basemapNAIP2009);

Any help or existing example is much appreciated.
0 Kudos
1 Reply
HemingZhu
Occasional Contributor III
I can add an ArcGISImageServiceLayer with a different spatialReference than the initially set extent and other layers in the map such as the one from ESRI (http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer).  When I try to use the same Imageserver layer as a new.dijit.BasemapLayer it does not reproject correctly as when adding it by just using the usual map.addLayer function.

I have tried it two different versions of this but neither works.

Version #1
var NAIP2009params = new esri.layers.ImageServiceParameters();
    NAIP2009params.noData = 0;
    var islNAIP2009 = new esri.layers.ArcGISImageServiceLayer("http://gisservice.mt.gov/ArcGIS/rest/services/MSDI_Framework/NAIP_2009/ImageServer", {
        imageServiceParameters: NAIP2009params
    });

    var basemapNAIP2009 = new esri.dijit.Basemap({
        layers: [islNAIP2009],
        id: "bmNAIP2009",
        title: "NAIP 2009"
    });
    basemaps.push(basemapNAIP2009);

Version #2
    var basemapNAIP2009 = new esri.dijit.Basemap({
        layers: [new esri.dijit.BasemapLayer({
            url: "http://gisservice.mt.gov/ArcGIS/rest/services/MSDI_Framework/NAIP_2009/ImageServer"
        })],
        id: "bmNAIP2009",
        title: "NAIP 2009"
    });
    basemaps.push(basemapNAIP2009);

Any help or existing example is much appreciated.


Look into this. http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/basemapgallery.htm.
All the Basemaplayer has to share the same SR
0 Kudos