javascriptrasterarcgis

Display Raster Layer using ArcGIS Javascript API


I Want to display a raster layer on to my page using ArcGIS JavaScript API. Loading Feature layer is easy and pretty forward but the raster layer is giving me hard time.

Here is the the MapService: http://ags.servirlabs.net/ArcGIS/rest/services/ReferenceNode/TRMM_30DAY/MapServer/0 which is Raster layer.

Do you have any ideas on how to do this?


Solution

  • You can add raster layers to your map using the ArcGISTiledMapService layer, for example:

    // assuming 'map' is a reference to your map
    map.addLayer(new esri.layers.ArcGISTiledMapServiceLayer("http://ags.servirlabs.net/ArcGIS/rest/services/ReferenceNode/TRMM_30DAY/MapServer"));
    

    There are some good examples on the ArcGIS JavaScript API site here:

    https://developers.arcgis.com/en/javascript/jssamples/#tiled_layers

    One thing to be aware of with tiled layers is that you can only add tiled layers to your map if they are using the same spatial reference. You can't add a layer as a tiled layer with a different spatial reference as it's cache of tiles have already been produced using it's spatial reference. You can add a layer as a Dynamic layer to re-project it.