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

Home » Public Forums » archive » Re: Finding pixel values of GeoTIFF image based on lat/lon (ENVI and IDL give different results).
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Finding pixel values of GeoTIFF image based on lat/lon (ENVI and IDL give different results). [message #81966 is a reply to message #81961] Mon, 05 November 2012 10:15 Go to previous message
DavidF[1] is currently offline  DavidF[1]
Messages: 94
Registered: April 2012
Member
Sobriquet writes:

> I have ~700 GeoTIFF images of dimensions around 4000x4000.I have the lat/long coordinates of 9 points from which I need to extract information. The images are projected on the Albers Conical Equal Area projection. I need to find the closest pixel value (sample, line image coordinates) that matches the lat/lon pairs. I previously used the approach described here: http://www.idlcoyote.com/map_tips/pixel_to_ll.html
>

> However, I was unable to find a matching pair of lat/long in both arrays or convert the closest match between the two to pixel coordinates.

Humm. I'm not sure you are following the approach described in that article, because I see no evidence in your code that you are reversing your TIFF image in Y, etc., etc.

If I were going to do this I *would* follow the approach in the article, exactly, up to the point where I had the two vectors uvec and vvec. Then,
I would convert the point (presumably in lat/lon) you want to find into projected meter values and find the image index with Value_Locate, like this:

pt_lon = -148.23300
pt_lat = 64.7000

xy = Map_Proj_Forward(pt_lon, pt_lat, Map_Structure=Albermap)
pt_x = xy[0]
pt_y = xy[1]

xindex = Value_Locate(uvec, pt_x)
yindex = Value_Locate(vvec, pt_y)

Print, 'Image Value: ', image[xindex,yindex]

ll = Map_Proj_Inverse(uvec[xindex], vvec[yindex], Map_Structure=Albermap)
Print, 'Nearest Pixel Location (lon/lat): '
Print, ' Longitude: ', ll[0], ' Image X Coord: ', xindex
Print, ' Latitude: ', ll[1], ' Image Y Coord: ', yindex

I wouldn't use the SPHERE_RADIUS keyword in Map_Proj_Init either. I can't tell if it is hurting you, but it can't be doing you any good. :-)

Cheers,

David
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: cgcolorbar problem in postscript
Next Topic: ndvi color table

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

Current Time: Sun Oct 12 08:16:52 PDT 2025

Total time taken to generate the page: 0.87913 seconds