Re: get LAT/LON from georef image [message #65159 is a reply to message #65075] |
Thu, 12 February 2009 02:03   |
titan
Messages: 59 Registered: March 2006
|
Member |
|
|
On Feb 11, 8:08 pm, David Fanning <n...@dfanning.com> wrote:
> titan writes:
>> Could this article be used even if my image is not e GEOTIFF image?
>
> If you have map projection information, and you know
> the location of one corner (or center, I guess) of
> your image, yes.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
I have another idea and I would like to know if you think it's
correct.
Considering the answer of Jean H. I realize that I could still use the
ENVI routine ENVI_CONVERT_FILE_COORDINATES but in an "handcrafted"
way:
;; transform the number of sample and line in integer value
ns_int = fix(img_ns) ;lat
nl_int = fix(img_nl) ;lon
;; Jean H. suggests that every pixel should be defined by a couple of
values so I have to determine who between ns_int and nl_int is the
biggest value
IF (ns_int GT nl_int) THEN BEGIN
;; once the higher value has been defined, I could create two vector
of the same length
x_coord=indgen(fix(img_ns))
y_coord=indgen(fix(img_ns))
;; and now I can use the ENVI routine
ENVI_CONVERT_FILE_COORDINATES,img_fid_open,x_coord,y_coord,l at_map,lon_map,/
TO_MAP
;; in order to obtain the correct dims again and knowing that, in this
case, vector of ns (lat) is bigger than the vector of nl (lon) I have
to cut this one to its original dimension
lon_map=lat_map[0:img_nl-1]
;; if, on the contrary, integer value of nl (lon) is bigger than the
the one of ns (lat)
;; the procedure considers two vectors of the same dims vector of ns
has
ENDIF ELSE BEGIN
IF (nl_int GT ns_int) THEN $
x_coord=indgen(fix(img_nl))
y_coord=indgen(fix(img_nl))
ENVI_CONVERT_FILE_COORDINATES,img_fid_open,x_coord,y_coord,l at_map,lon_map,/
TO_MAP
;; and now the vector to be cut is the one of latitude
lat_map=lat_map[0:img_ns-1]
ENDELSE
;; finally we have the two vector of lat and lon and we can also can
create a matrix of lat lon with the same dims of our image
matrix_coord=dblarr(fix(img_ns),fix(img_nl))
matrix_coord = [lat_map,lon_map]
David or Jean H. what do you think about this procedure?
thanks
Bartolomeo (alias Titan)
|
|
|