Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Idl-pvware > Problem with EN...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 5460 of 6017
Post > Topic >>

Problem with ENVI_CONVERT_File_COORDINATES

by Wasit.Weather@[EMAIL PROTECTED] Feb 24, 2008 at 08:14 AM

Hi,
I am having trouble to retrive a pixel value by geographic long lats.
Following is the code. two values obtained by sample/line coordinate
and geographic long lats are different. What is wrong with my code?
Thanks

 ;======================================================
  ;Open a file using envi batch

 envi_open_file, fNameInput, r_fid=fid
  if (fid eq -1) then begin
    envi_batch_exit
    return
  endif
  ;
  ; Open the file to read in array
  OpenR, Lun, fNameInput,/Get_Lun

  ; Setup the values for the keywords

  envi_file_query, fid, ns=ns, nl=nl, nb=nb, data_type=data_type,$
	               interleave=interleave, dims=dims

  Image=Make_Array(ns,nl,nb); create an array to get the values of the
image
  readu, lun, Image; read the image pixel values into the array
  Free_Lun, Lun

  ;print a pixel value by sample and rows
  print, image[1040, 404, *] ;this prints pixel values for 6 bands
  ; this fine, correct

  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;Retrieve a pixel value by geographic long lats
  ;get coordinates for image and convert to lat/lon
	  xcoord=116.521
	  ycoord= 40.1455

  ;change from lat/long coordinates to pixel values

  ENVI_CONVERT_File_COORDINATES, fid, xF, yF,xcoord, ycoord
  for nb=0, nb-1 do begin  ;read multi band data
      data = ENVI_GET_DATA(fid=fid, dims=dims, pos=nb); pos is the
name of the band, 0=1st band, 5=6th band
      output=data[xcoord, ycoord,*]
      print, output; this prints pixel values for 6 bands
  endfor
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 




 7 Posts in Topic:
Problem with ENVI_CONVERT_File_COORDINATES
Wasit.Weather@[EMAIL PROT  2008-02-24 08:14:47 
Re: Problem with ENVI_CONVERT_File_COORDINATES
Pete <peter.eddy@[EMAI  2008-02-25 08:10:28 
Re: Problem with ENVI_CONVERT_File_COORDINATES
bulrushmower@[EMAIL PROTE  2008-02-25 18:27:32 
Re: Problem with ENVI_CONVERT_File_COORDINATES
Jean H <jghasban@[EMAI  2008-02-26 09:37:08 
Re: Problem with ENVI_CONVERT_File_COORDINATES
Allard de Wit <allard.  2008-02-26 00:18:32 
Re: Problem with ENVI_CONVERT_File_COORDINATES
Chris Jengo <cjengo@[E  2008-02-26 07:21:03 
Re: Problem with ENVI_CONVERT_File_COORDINATES
Wasit.Weather@[EMAIL PROT  2008-02-26 17:04:50 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 22:03:10 CDT 2008.