Select to view content in your preferred language

Adding a geo-referenced tiff to a map

3423
6
Jump to solution
08-14-2012 10:03 AM
SethEllingson
Emerging Contributor
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.
0 Kudos
1 Solution

Accepted Solutions
derekswingley1
Deactivated User
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.

View solution in original post

0 Kudos
6 Replies
BetsySchenck-Gardner
Deactivated User
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);

Hope this helps.
0 Kudos
SethEllingson
Emerging Contributor
Thank you for the reply, this will help, but does the api support the .tiff format? I can't get the image to display at all.
0 Kudos
BetsySchenck-Gardner
Deactivated User
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.
0 Kudos
derekswingley1
Deactivated User
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.
0 Kudos
SethEllingson
Emerging Contributor
Thank you for the replies, this will save me from further testing with tif's.
0 Kudos
derekswingley1
Deactivated User
Glad to help, we'll add supported file formats to the docs.
0 Kudos