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

Home » Public Forums » archive » envi_convert_file_coordinates
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
envi_convert_file_coordinates [message #67527] Mon, 03 August 2009 09:17 Go to next message
woods1 is currently offline  woods1
Messages: 24
Registered: August 2009
Junior Member
Hi,
i have with envi. i try to convert the lat/lon coordinates to Pixel
values, but my results are negative and big.

this is my program:

the number of samples are 36800 and the number of lines are 57600.

Pro news, ego

filename = envi_pickfile(title = 'DeMarine-DEKO')
if(filename eq '')then return

envi_open_file, filename, r_fid=De_fid

envi_file_query, De_fid, ns=ns, nl=nl, nb=nb, pos=pos,$
dims=dims, data_type=type, sname=sname

dims = [-1L, 0, ns-1, 0, nl-1]

pos = lindgen(nb)

map_info = envi_get_map_info(fid =De_fid)
print, map_info


proj_u = map_info.proj; Auszug Projektion von Struktur $ MAP
proj_dd = envi_proj_create(/geographic);Projektion fuer lat/lon
Daten
proj_aa = envi_proj_create(/utm, zone= 37, /south, datum=8,
units=meters )



xf = [0, ns-1]
yf = [0, nl-1]

; Establish file coordinate system
fwest_p=1; NW corner of file is 0,0
fnorth_p=1; NW corner of file is 0,0
feast_p=fwest_p+ns
fsouth_p=fnorth_p+nl
; Establish map coordinate system
fxcent_p=map_info.mc[0]; UTM coordinates defined from center
fycent_p=map_info.mc[1]; UTM coordinates def. from center
fxcent_u=map_info.mc[2]
fycent_u=map_info.mc[3]
xpxsz_u=map_info.ps[0]
ypxsz_u=map_info.ps[1]
fwest_u=fxcent_u+(long(fwest_p-fxcent_p)*xpxsz_u)
feast_u=fxcent_u+(long(feast_p-fxcent_p)*xpxsz_u)
fnorth_u=fycent_u+(long(fycent_p-fnorth_p)*ypxsz_u)
fsouth_u=fycent_u+(long(fycent_p-fsouth_p)*ypxsz_u)


print, 'fxcent_p:',fxcent_p ; the result is 0.00000000
print, 'fycent_p:',fycent_p ; the result is 0.00000000
print, 'fxcent_u:',fxcent_u ; the result is 296999.38
print, 'fycent_u:',fycent_u ; the result is 5039000.6
print, 'fwest_u:',fwest_u ; the result is 297000.63
print, 'feast_u:',feast_u ; the result is 343000.63
print, 'fnorth_u:',fnorth_u ;---------------is
5038999.4
print, 'fsouth_u:',fsouth_u ;---------------is 4966999.4

;convert map coordinate boundaries to DD
envi_convert_projection_coordinates,[fxcent_u,feast_u,fxcent _u,
feast_u], $

[fsouth_u,fsouth_u,fycent_u,fycent_u],proj_aa,fcornerx_dd,fc ornery_dd,proj_dd

print,fcornerx_dd ; the latitude is :36.405251
36.992822 36.434432 37.015407
print,fcornery_dd ; the longitude is :-45.423007
-45.434850 -44.775521 -44.787101

envi_convert_file_coordinates, De_fid, xmap, ymap, fcornery_dd,
fcornerx_dd
print, xmap ;-237635.84 -237635.85 -237635.32
-237635.33
print, ymap ;4031171.4 4031170.9 4031171.4
4031170.9

i think xmap and ymap are false, but i don't where is the error.
my intention is to convert to pixel values.

please, can somebody help me.

thanks
end
Re: envi_convert_file_coordinates [message #67611 is a reply to message #67527] Tue, 04 August 2009 11:54 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Hi,

I believe you are using the wrong variable... Your map is in UTM (not
too clear though) but you use it as if it was DD...

> envi_open_file, filename, r_fid=De_fid

open the file

> map_info = envi_get_map_info(fid =De_fid)

get the map info

> fxcent_p=map_info.mc[0]; UTM coordinates defined from center

you say it is in UTM

> envi_convert_file_coordinates, De_fid, xmap, ymap, fcornery_dd,
> fcornerx_dd

You use the fid of the file, so you are converting from UTM to pixel
coordinates (by the way "pixel value" refers to the content of the
pixel, not its coordinates). However, you are not using UTM coordinates
but geographic ones... So basically, you are converting coordinates that
are within 180m of the equator and from the central meridian of your UTM
zone.

Jean
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: 3D UserSym?
Next Topic: Re: String Array to 'regular' array?

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

Current Time: Wed Oct 08 13:43:58 PDT 2025

Total time taken to generate the page: 0.00663 seconds