I am working with idl in envi,I want to use ENVI_CONVERT_FILE_COORDINATES in case of finding pixel value of specified point,for this porpuse I have lat and long data of my point but I need to open image in IDL as a georefrenced image I noticed that image that is opened using ENVI_OPEN_FILE is not georefrenced,But if I open the same image using ENVI GUI it is georefrenced. So I think the problem is with opening image with its georefrenced data.

How do I open an georeferenced image in IDL?

1 Answer 1


ENVI_OPEN_FILE can open a georeferenced image. You should use ENVI_GET_MAP_INFO function to get the map information. You can see this webpage

  • Dear @JZH thank you for your help.So you mean after oppening file using ENVI_OPEN_FILE I call that function and It will fix the location of pixels base on lat and long? Nov 23, 2014 at 19:55
  • ENVI_GET_MAP_INFO can get the map info through the same fid opened by ENVI_OPEN_FILE. But if you want to get the lat and long of a pixel, use ENVI_CONVERT_FILE_COORDINATES.
    – JZH
    Nov 24, 2014 at 5:10
  • In fact I have a lat and long and I want to get their DN value on picture using IDL,SO I tried to use ENVI-CONVERT-FILE-CORDINATE but It gives me wrong data(I think it is because of not openning file as a georefrence image)..So what I shoould do?I must first open File using ENVI-OPEN_FILE Then using ENVI_GET_MAP_INFO get map info and then I use ENVI_CONVERT_FILE_COORDINATES to get DN values? Nov 24, 2014 at 12:31
  • 1, use ENVI_OPEN_FILE to open the georeferenced image (in this case, the map info is already prepared);2,use ENVI_CONVERT_FILE_COORDINATES with inputs of lat and lon to get the right pixel coordinate (make sure that the image is geographical projection to match the lat and lon)
    – JZH
    Nov 24, 2014 at 12:49
  • Thank you for your help.I used this code:ENVI> ENVI_OPEN_FILE,'E:\Subset_BIP.hdr', R_FID=FID, NO_REALIZE=1 ENVI> ENVI_OPEN_FILE,'E:\MASTER\Payan_Name\DataSer\Output\162\0730\1-1Georefrence_BIP\Subset_BIP.hdr', R_FID=FID, NO_REALIZE=1 ENVI> ENVI_CONVERT_FILE_COORDINATES,FID,xf,yf,Xloc,Yloc ENVI> Yloc=48.742834 ENVI> Xloc=31.345074 ENVI> ENVI_CONVERT_FILE_COORDINATES,FID,xf,yf,Xloc,Yloc ENVI> xf 54.553658073699950 ENVI> yf 3614.6857571678161 ENVI> but I think the result is not right,Does it must be a location of pixel?an integer number? Nov 24, 2014 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.