- 积分
- 4097
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-11-6
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
大家好!我想用idl通过经纬度批量提取遥感图像的dn值,参考了http://blog.sina.com.cn/s/blog_942ff76e0102v406.html的帖子,但我在批量处理的时候,总是出现这个错误:Object reference type required in this context: MAPINFO.请各位大神帮忙看一下,问题出在哪?请指导一下,谢谢!- pro Extrat_TIFDN3
- Compile_opt IDL2
- ENVI,/RESTORE_BASE_SAVE_FILES
- ENVI_BATCH_INIT
- directory = 'E:\Data\modis\tif\'
- product = '*AOT.tif'
- files = file_search(directory + product)
- ;beijing
- longitude=116.381
- latitude=39.977
- for i=0,n_elements(files)-1 do begin
- ;Convert to the Projection as same as the Imput Image
- ENVI_OPEN_FILE,files[i], r_fid=fid ;1. Retrieve the Pojection Info from Input Image
- ENVI_FILE_QUERY, fid, dims=dims;some parameters will be used to get data
- ProjInfo=ENVI_GET_PROJECTION(fid=fid)
- OriProj=ENVI_PROJ_CREATE(/geographic) ;2. Original projection of Lon/Lat
- ENVI_CONVERT_PROJECTION_COORDINATES,longitude,latitude, OriProj,otX, otY, ProjInfo ;3. Process of Convert
- ;;Extract the Col & Row for the input Geoinfo
- mapinfo=ENVI_GET_MAP_INFO(fid=fid) ;1. Geolocation of Upper Left Point (0, 0) of the Input Image
- print,mapinfo
- <FONT color=red>ULlon=mapinfo.mc(2) :出错!!! Object reference type required in this context: MAPINFO.</FONT>
- print,ULlon
- ULlat=mapinfo.mc(3)
- Xsize=mapinfo.PS(0) ;2. X/Y Size of the Input Image
- Ysize=mapinfo.PS(1)
- Row=(otX-ULlon)/Xsize ;3. Calculate the Number of Col & Row
- Coll=(otY-ULlat)/Ysize
- Row=fix(abs(Row)) ;Subscript directly from 0
- Coll=fix(abs(coll))
- tiff=Read_Tiff(files[i], GeoTIFF=GeoVar)
- NC_DN=tiff(Row, Coll)
- print,NC_DN
- endfor
- envi_batch_exit
- print,'job done!'
- end
复制代码
|
|