Ok, well, that's good to know. I looked at the API reference for mapImage and TIFF is not one of the supported data types:Known values: gif | jpg | png | bmpTo use the mapImageLayer option, your GP result would have to return an image in one of those other formats. This might be a catch-22 for you IF you want the user to be able to query (i.e. display an infoWindow) the cell values. Sadly, mapImageLayers don't support this.Again, I'm stretching my knowledge base a bit with this so I'm really hoping someone from ESRI can chime in! SteveEDIT: I'm starting to think Derek is right (I really shouldn't doubt is suggestions!). Can you post more of your code, specifically the lead up to your GP service and then the callback routine for the results?
Known values: gif | jpg | png | bmp
function initSelectionToolbar(myMap){ selectionToolbar = new esri.toolbars.Draw(map); dojo.connect(selectionToolbar, "onDrawEnd", function(geometry) { selectionToolbar.deactivate(); var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25])); var graphic = new esri.Graphic(geometry, symbol); var geoPoly= esri.geometry.webMercatorToGeographic(geometry); //map.graphics.add(graphic); xmax= (geoPoly.xmin*-1); xmin= (geoPoly.xmax*-1); ymin= (geoPoly.ymin); ymax= (geoPoly.ymax); selectNameModelVal = document.getElementById('options1').value; selectNameScenarioVal = document.getElementById('options2').value; selectNameVariableVal = document.getElementById('options3').value; selectNameDay1Val = document.getElementById('options4').value; selectNameDay2Val = document.getElementById('options5').value; selectNameYear1Val = document.getElementById('options6').value; NormalsYears = document.getElementById('options7').value; var gpTask = new esri.tasks.Geoprocessor("http://inside-dev2.nkn.uidaho.edu:6080/arcgis/rest/services/REACCH/MACAnormsRas/GPServer/MACA Normals Histogram- raster output"); var params = { "GCM_Model":selectNameModelVal, "GCM_Scenario":selectNameScenarioVal, "Variable":selectNameVariableVal,"Day_1":selectNameDay1Val,"Day_2":selectNameDay2Val, "Year_1":selectNameYear1Val, "Number_of_years_to_average_to_create_climate_normals":NormalsYears,"Min_Lat":ymin,"Max_Lat":ymax,"Min_Lon":xmin,"Max_Lon":xmax }; dojo.connect(gpTask, "onJobComplete",onTaskComplete); dojo.connect(gpTask, "onError",onTaskFailure); dojo.connect(gpTask, "onStatusUpdate",onTaskStatus); gpTask.submitJob(params); }); } }
function onTaskComplete(jobInfo) { /*get the value of an output parameter Buffer_polygons using getResultData. The name of the output may vary in your gpTask*/ var gpTask = new esri.tasks.Geoprocessor("http://inside-dev2.nkn.uidaho.edu:6080/arcgis/rest/services/REACCH/MACAnormsRas/GPServer/MACA Normals Histogram- raster output"); dojo.connect(gpTask,"onGetResultDataComplete",onTaskResultComplete); gpTask.getResultData(jobInfo.jobId,"Output");
function onTaskResultComplete(paramResult) { //retrieve the value of the parameter from the paramresult var featureSet = paramResult.value.url;
No, not quite. It's a little more complicated than that. 😄*IF* mapImageLayer is the correct layer type to use (and again, I'm not sure it is), you would construct your layer something like this: var stormPrecipMi = new esri.layers.MapImage({ 'extent': { 'xmin': -125.721041648, 'ymin': 45.1377145386, 'xmax': -119.246964944, 'ymax': 51.0722848511, 'spatialReference': { 'wkid': 4326 }}, 'href': "http://radar.weather.gov/ridge/RadarImg/NTP/ATX_NTP_0.gif" }); stormPrecipMi.height = 550; stormPrecipMi.width = 600; stormPrecipMi.scale = 1; nwsStormPrecipLayer = new esri.layers.MapImageLayer({ id: 'nwsStormPrecip', opacity: 0.5 }); nwsStormPrecipLayer.addImage(stormPrecipMi); map.addLayer(nwsStormPrecipLayer,7);Note that you'll need to know the coordinate extent of your results (but you should know that since you're passing a shape or extent to your GP service, right?). Place the URL returned from your GP results where I have the URL under the 'href' parameter in the mapImage constructor.Hopefully someone else more knowledgable will chime in and confirm whether or not mapImageLayer is the right path to take.Steve
var stormPrecipMi = new esri.layers.MapImage({ 'extent': { 'xmin': -125.721041648, 'ymin': 45.1377145386, 'xmax': -119.246964944, 'ymax': 51.0722848511, 'spatialReference': { 'wkid': 4326 }}, 'href': "http://radar.weather.gov/ridge/RadarImg/NTP/ATX_NTP_0.gif" }); stormPrecipMi.height = 550; stormPrecipMi.width = 600; stormPrecipMi.scale = 1; nwsStormPrecipLayer = new esri.layers.MapImageLayer({ id: 'nwsStormPrecip', opacity: 0.5 }); nwsStormPrecipLayer.addImage(stormPrecipMi); map.addLayer(nwsStormPrecipLayer,7);
I think the syntax issue is that what's returned by your GP service isn't a dynamicMapServiceLayer. I'm not sure which of the other "layer types" that you should use but I'm going to guess that it's mapImageLayer (which incorporates mapImage).
var normalslayer = new esri.layers.ArcGISDynamicMapServiceLayer(featureSet);
var normalslayer = new esri.layers.MapImageLayer(featureSet);
gpTask.getResultData(jobInfo.jobId,"Output");
function onTaskResultComplete(paramResult) { //retrieve the value of the parameter from the paramresult var featureSet = paramResult.value.url; var normalslayer = new esri.layers.ArcGISDynamicMapServiceLayer(featureSet); }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.