Select to view content in your preferred language

tif file load on esri map

808
6
06-10-2023 01:31 PM
MousumiDeb
New Contributor

hello , 

I trying to display a tif file on esri map . Is there any sample code I can find

0 Kudos
6 Replies
UndralBatsukh
Esri Regular Contributor

You can set up your tif file as cloud optimized GeoTiff and add it using ImageryTileLayer. This sample shows how to do that. Be sure to read the sample description too: https://developers.arcgis.com/javascript/latest/sample-code/layers-imagerytilelayer-cog/

 

0 Kudos
MousumiDeb
New Contributor

thank you so much for replying . 

I uploaded my tif file  in the cloud. wrote the following code:

const layerraster = new ImageryTileLayer({
url: "https://drive.google.com/file/d/1xCqDMBjkzN8SgyFnzcfT0_E02Zpv4-SR/view?usp=drive_link"

});
map.add(layerraster);

but I am having error following: 

ri.layers.ImageryTileLayer] #load() Failed to load layer (title: '', id: '188b10b5755-layer-6') Object
m._consoleWriter @ (index):150
(index):150 [esri.views.LayerViewManager] Failed to create layerview for layer title:'', id:'188b10b5755-layer-6' of type 'imagery-tile'. Object

0 Kudos
UndralBatsukh
Esri Regular Contributor

You need optimize your tiff to be Cloud optimized tiff. Please take a look at the COG requirements here: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryTileLayer.html#addi...

Also you can watch this short video on COG: https://www.youtube.com/watch?v=SeWMENUJS7s - there are instructions how to convert your tif to COG towards the end of the video. 

0 Kudos
MousumiDeb
New Contributor

Hi Thanks again for the reply . can I convert the tif file in to COG in windows using gdal . What would be best environment to convert .

0 Kudos
MousumiDeb
New Contributor

Hi ,

I translated my tif file gdal translate and tried the following :

const layerraster = new ImageryTileLayer({
url: "https://drive.google.com/file/d/1UVU9vIKHduclGHN9TRwSh2l83vovik-V/view?usp=sharing"

});
map.add(layerraster);

but still not showing in the map . I attached my map here.

0 Kudos
UndralBatsukh
Esri Regular Contributor

The COG file must have pyramids built to be displayed.  This is not specific to cog. If you create an enterprise tiled image service without pyramid, you will get same behavior. In any case, you can build pyramids with build pyramids geoprocessing tool: https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/build-pyramids.htm

 

0 Kudos