I am trying to add a geo-referenced tiff to a map using the Javascript API. Are tiff's supported? I have not been able to do this using a map Image Layer or a Graphic Layer. Here is what I have tried with the map Image Layer:
var imageLayer = new esri.layers.MapImageLayer(); map.addLayer(imageLayer); var mi = new esri.layers.MapImage({ 'href': 'http://url.to.image/img.tiff' }); imageLayer.addImage(mi);
When I try this, no image appears. I don't get an error or anything, the image just doesn't show up. The tiff and the map are using the same projection. Any help would be appreciated.
esri.layers.MapImage adds the image to the map via an img tag. Since img tags can't use .tiff files, you cannot use a tiff with a MapImage. You need to stick with file formats supported by the img tag.
I was able to add an image to the map after I defined the four corners of the image. As far as I know, it doesn't read a tfw file or the header of a geotif. Here's an example of how I got it to work. The projection of my map was 3857 so my image had to be in the same projection:
var xminValue = -10897188.6297; var yminValue = 1929703.88984; var xmaxValue = -8790353.14023; var ymaxValue = 3759053.72948; var spatialReferenceValue = 3897;
var hrefValue = "http://www1.ln.ncddc.noaa.gov/website/AGSViewers/JS_Examples/data/amax.png"; var lyrSample = new esri.layers.MapImageLayer(); var lyr = new esri.layers.MapImage({'extent':{'xmin':xminValue,'ymin':yminValue ,'xmax':xmaxValue,'ymax':ymaxValue,'spatialReference':{'wkid':spatialReferenceValue}},'href':hrefValue}); lyrSample.addImage(lyr);
Don't believe so. I just took a tif image and it would not display. Maybe someone from ESRI would know for certain because their documentation doesn't seem to mention anything about acceptable formats. Sorry I can't help.
esri.layers.MapImage adds the image to the map via an img tag. Since img tags can't use .tiff files, you cannot use a tiff with a MapImage. You need to stick with file formats supported by the img tag.