aleks.franca@gmail.com writes:
> 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?
Humm, I'm going to a concert tonight. But have you tried NOT
treating them as strings. (I've never heard of this, honestly.)
Try just passing the integers. I've no idea why POLYFILLV
is complaining, but it is possible he is as confused about
your method as I am. If you have too many of the same points,
you might have to decimate your polygon. See my article on
MESH_DECIMATE for some suggestions. Then I would have a look
at your polygons to see if they still look right.
Wife's calling, have to go...
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.")
|