Re: get LAT/LON from georef image [message #65193 is a reply to message #65159] |
Mon, 16 February 2009 08:13   |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
> 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)
Bartolomeo,
Sorry for the delay in the answer... I just recovered from the flu!
Ok, so there are several conceptional errors in your text.
By doing x_coord=y_coord=indgen(img_ns), you would be getting the
coordinate of a 45degres line starting at pixel 0;0, until the line
touch the other side of the image (the diagonal of the image is the
image is a square). I doubt this information can be of any help. (see below)
You do:
matrix_coord=dblarr(fix(img_ns),fix(img_nl))
matrix_coord = [lat_map,lon_map]
This would not work, for a conceptual reason: what makes you believe
that the pixel size, in degrees, is the same at the top and at the
bottom of your image? or, seen with a different view, that the extent of
your image (again, in degrees, not in meters) is the same at the top and
the bottom of your image?
If you want to have every pixel coord, you must built the X.Y
coordinates of every pixels as I did in my previous post.
Jean
|
|
|