Re: How to extract pixel values from a GeoTIFF using an Esri Shapefile [message #74079 is a reply to message #74078] |
Sat, 25 December 2010 05:32   |
Paul Magdon
Messages: 8 Registered: January 2011
|
Junior Member |
|
|
On 23 Dez., 22:34, David Fanning <n...@dfanning.com> wrote:
> Paul Magdon writes:
>> ;Convert SHP to ROI object
>> myroi = OBJ_NEW( 'IDLanROI',( *ent.vertices)[0,*] ,(*ent.vertices)
>> [1,*] )
>
>> ;Apply ComputMask method
>> maskResult = myroi -> ComputeMask(DIMENSIONS = [s[0],
>> s[1]],MASK_RULE=2)
>
>> ; Here starts the problem; I have a 5000x5000 raster (img) and the
>> image coordinate system start with [0,0] but the myroi coordinates are
>> much higher (eg 227984.00 ; 991472.00) Thus everything is masked.
>> ;There is a keyword LOCATION for ComputeMask but I am not sure how to
>> use it and where to get the right values for it
>
> I have to admit I have never done this before. (Although
> I would like to try if you could make the image and
> shape file available to me.) But, it seems to me
> that when you create the ROI, you will have to give
> the ROI the range of the image to make this work.
>
> mapCoord -> GetProperty, XRANGE=xr, YRANGE=yr
> myroi = OBJ_NEW( 'IDLanROI',( *ent.vertices)[0,*] ,$
> (*ent.vertices)[1,*], ROI_XRANGE=xr, $
> ROI_YRANGE=yr )
>
> That way, the ROI and the image are mapped to the same
> coordinate system.
>
> I'm curious to know if that works. :-)
>
> Cheers,
>
> David
>
> P.S. The next book I am thinking of writing is a small
> book about map projections in IDL. The more examples I
> have like this, the better. I have to write this book
> before I forget everything I've learned in the past four
> years. :-)
>
> --
> 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.")
Dear David,
sorry for my late reply but as we have Christmas there are other
duties as well :) . By the way: merry Christmas!
I tried your suggestion to use ROI_XRANGE and got the following Error:
% Keyword ROI_XRANGE not allowed in call to: OBJ_NEW
As fare as I understand the IDL documentation ROI_XRANGE can not be
set for an IDLanROI object.
Today I will try to use the LOCATION keyword or find an other option
to transfer the UTM coordinates into proper pixel coordinates.
I will send you a shp + corresponding raster as soon as possible.
Cheers,
Paul
|
|
|