comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » How to spatial subset files by ENVI vector file (EVF) or other shapefile ?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
How to spatial subset files by ENVI vector file (EVF) or other shapefile ? [message #57587] Mon, 17 December 2007 04:58 Go to next message
Lucia is currently offline  Lucia
Messages: 5
Registered: June 2007
Junior Member
I can spatial subset files by EVF in ENVI, but I need to do it by IDL.
Re: How to spatial subset files by ENVI vector file (EVF) or other shapefile ? [message #57722 is a reply to message #57587] Mon, 17 December 2007 08:52 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Lucia wrote:
> I 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_pix el), ns, nl)


endfor
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: How to spatial subset files by ENVI vector file (EVF) or other shapefile ?
Next Topic: TAB in IDLWAVE

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 23:30:53 PDT 2025

Total time taken to generate the page: 1.60203 seconds