Image Server javascript viewer image format issues

595
3
06-21-2010 11:23 AM
GlenRhea
New Contributor
I'm trying to get jpg image exports from AIS using javascript, I currently get png (too slow). It works fine using flex. My code is below.


dojo.require("esri.map");
  function Init() {
    dojo.style(dojo.byId("map"), { width: dojo.contentBox("map").w + "px", height: (esri.documentBox.h - dojo.contentBox("navTable").h - 40) + "px" });
    var map = new esri.Map("map");
    var imageServiceLayer = new esri.layers.ArcGISImageServiceLayer("http://www.geostor.arkansas.gov/ArcGIS/rest/services/IMAGE_SERVICES/2006_1M_Statewide_Ortho/ImageServer");
 imageServiceLayer.format = "jpg";
    map.addLayer(imageServiceLayer);
  }
  dojo.addOnLoad(Init);
0 Kudos
3 Replies
GlenRhea
New Contributor
I hate to call PSG for something this simple but I will if I have to, the js viewer using the pngs is just too slow to load vs the flex one.

Nobody has any ideas or suggestions?
0 Kudos
Randall_XavierRebello
Esri Contributor
Try replacing your bit of code with mine below.
What I am doing is defining parameters for the image service layer. I define a parameters variable and then set the format parameter to jpg. The Image service is then added to the map with the defined parameters.
I have also attached a sample code with this reply. Download an double click on the HTML.

        var params = new esri.layers.ImageServiceParameters();
        params.format = "jpg";
        var imageServiceLayer = new esri.layers.ArcGISImageServiceLayer("http://www.geostor.arkansas.gov/ArcGIS/rest/services/IMAGE_SERVICES/2006_1M_Statewide_Ortho/ImageServer",{imageServiceParameters: params});
        map.addLayers([imageServiceLayer]);


Hope this helps.
Regards,
Randall
0 Kudos
GlenRhea
New Contributor
Looks like that did the trick, thanks!

Here is a link to the page I was working on if you would like to see it in action:
http://dev.geostor.arkansas.gov/g6/g6_ags-test_page.html

Not my best coding but good enough for me as I will be the only one using it.
0 Kudos