Post by LuciaI can spatial subset files by EVF in ENVI, but I need to do it by IDL.
Hi,
You can start with this..
Jean.
-------------
;open the evf file
vectID = ENVI_EVF_OPEN(VectorToOpen)
;get the numbers of records (polygons) in the vector file
ENVI_EVF_INFO, vectID, num_recs = numRecs
;Open the image. We will get the pixel locations of the polygons out of it.
envi_open_file,ImageFilename,r_fid=fid
;get the X and Y dimensions of the image
ENVI_FILE_QUERY, fid, nl=nl, ns=ns
; Loop through each record
for record=0,numRecs-1 do begin ;
;get the coord of each nodes of the current polygon; Coords are
projected.
pts_polygon_proj = envi_evf_read_record(vectID, record)
;convert the projected coordinates of the nodes to a line/column
coordinate
envi_convert_file_coordinates,fid,pts_X_polygon_pixel,pts_Y_polygon_pixel,pts_polygon_proj[0,*],pts_polygon_proj[1,*]
;Get the 1D cell indices of the cells lying under the current polygon.
polygonIndices =
polyfillv(round(pts_X_polygon_pixel),round(pts_Y_polygon_pixel), ns, nl)
endfor