Re: how to get pixel data corresponding to some coordinates' points? [message #56214 is a reply to message #56208] |
Mon, 15 October 2007 00:04   |
d.poreh
Messages: 406 Registered: October 2007
|
Senior Member |
|
|
On Oct 14, 3:22 am, "Jean H." <jghas...@DELTHIS.ucalgary.ANDTHIS.ca>
wrote:
> highstone wrote:
>> On Oct 14, 1:21 am, "Jean H." <jghas...@DELTHIS.ucalgary.ANDTHIS.ca>
>> wrote:
>>> highstone wrote:
>>>> I have a point vector file(.shp) containing a lot of weather
>>>> stations, how can I get corresponding pixel data from a '.img' file
>>>> with least works? 3q!
>>> if you have envi too, you can use envi_convert_file_coordinates
>
>>> Jean
>> to Jean,
>> I look up the help of ENVI, find the role of
>> "envi_convert_file_coordinates" is to "Use this procedure to convert
>> x,y pixel coordinates to their corresponding map coordinates".
>
> "and vice-versa"
> By pixel coordinate, they mean the row and column number, by map
> coordinate, they mean the geographical coordinate (lat-long or else)
>
> Maybe I
>
>> didn't have said clearly. My vector file and raster file had the same
>> coordinates, what I want to get is the pixels' data corresponding to
>> these points in vector file as soon as possible.so I don't know why to
>> use this procedure?
>> please forgive me for my poor knowledge,3q.
>
> Yes, the idea is, if you want to program it (maybe there is a built-in
> tool... I don't know... ArcGis has one for sure):
> 1)open your shape file
> 2)get the coordinates (let's say, lat-long) of each point in an array
> 3)open your image to gets its FID
> 4)call envi_convert_file_coordinates, fid, X,Y, lat,long (with NO
> keyword), which will change your lat-long to the corresponding pixel row
> and column on your image
> 5)extract the pixels values, using image[X,Y]
>
> the help file for envi's function is terrible and often needs a few
> dozen reading before to get the code working well!
>
> Jean
Hi;
There is an easy way to do this. But Jean's way is robust. Just read
your data in ENVI and follow this direction: file->save image as-
> image file. In the opened window go to *spatial subset*and choose
*map* you can easily subset your data based on lat-long or pixel base.
It is so easy.
ciao
|
|
|