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

Home » Public Forums » archive » Re: Get pixel info from an geotiff ROI (lat long)
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: Get pixel info from an geotiff ROI (lat long) [message #57591 is a reply to message #57590] Sun, 16 December 2007 17:10 Go to previous messageGo to previous message
aleks.franca@gmail.co is currently offline  aleks.franca@gmail.co
Messages: 33
Registered: March 2007
Member
> POLYFILLV will return all the pixel indices inside your
> polygon. But I would really think about putting these
> ROIs into IDLanROI objects. That way you get methods that
> do just about everything you can think of to do with an
> ROI.
>
> Cheers,
>
> David

Thank you David. Your hint was of good help, but I still have some
problems. I'm using POLLYFILLV because I still have problems with
objects, but I'll get over it soon.

The input is a txt file with the coordinates of a Region in lat long.
I take that and interpret each coordinate in a pixel value:

vetGridX = intarr(n_elements(vetLonX))
vetGridY = intarr(n_elements(vetLatY))

for i=0, n_elements(vetGridX)-1 do $
begin
vetGridX[i] = fix((vetLonX[i] - LongMin) / pixelSize_X)
vetGridY[i] = fix((vetLatY[i] - LatMin) / pixelSize_Y)
endfor
vetGridY = (2791-vetGridY) ;2791 is the ysize of the image

;I have then 2 vectors if integer
VETGRIDX INT = Array[554]
VETGRIDY INT = Array[554]

;After that I make them become vectors of a single string.
vetGridX = strtrim(vetGridX, 2)
vetGridY = strtrim(vetGridY, 2)

vetGridX = STRJOIN(vetGridX, ',')
vetGridY = STRJOIN(vetGridY, ',')

;This is an example of the first and last points of the string.
;Note that some points are repeated.
VETGRIDX STRING = 769,769,770,770,770 ...
771,771,770,770,770,770,770,770,770,770
VETGRIDY STRING = 1100,1100,1100,1100,1100 ...
1101,1101,1101,1101,1101,1101,1101,1100,1100,1100

;I use the function like this:
P = img[polyfillv([VETGRIDX], [VETGRIDY], 4453, 2791)]

And this is the result
% POLYFILLV: Not enough valid and unique points specified.


I've thougth that the first and the last point cannot repeat, so I've
tried that and the function works just once and never happened again.
That's very crazy.

Would someone help me on that?

Thank you!

Aleksander
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Get pixel info from an geotiff ROI (lat long)
Next Topic: Matrix rank

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

Current Time: Sat Oct 11 00:30:22 PDT 2025

Total time taken to generate the page: 0.24052 seconds