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

Home » Public Forums » archive » Re: Shape to raster
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Shape to raster [message #78114] Thu, 27 October 2011 09:55 Go to next message
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
On Oct 26, 12:52 pm, Fabzou <fabien.mauss...@tu-berlin.de> wrote:
> Dear IDLers,
>
> My apologies if this question has been posted before.
>
> I have a polygon vector file from which I know the coordinates within a
> grid (subpixel precision) and I would like to make a mask from this
> information (within the polygon = 1, outside = 0).

I have a routine INSIDE.PRO which does this. I don't remember where it
came from, and I'm not in front of my computer to check the file, but
it does the job without any ENVI nonsense.

Do a web search for it, and if it doesn't turn up, repost to this
thread and I'll turn up the provenance.

--Edward H.
Re: Shape to raster [message #78117 is a reply to message #78114] Thu, 27 October 2011 05:30 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Fabzou writes:

> Wow, I am just starting to realize that this IDLanROI object is going to
> change a lot of things in my programs!
>
> But, as far as I understand the documentation, it only stores one
> entity. So, if I have many entities (often the case in my shapefiles), I
> have to instance many IDLanROI objects, generate a mask for all of them
> and then combine the masks together? Or did I miss something again?

No, you can do all this with one IDLanROI object. Simply
use the MASK_IN keyword to the Compute_Mask method to
pass in and modify the mask from previous polygons.

Yes, the IDLanROI object is one of those game changers
in IDL, once you learn of its existence. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Shape to raster [message #78123 is a reply to message #78117] Thu, 27 October 2011 02:40 Go to previous messageGo to next message
Fabzou is currently offline  Fabzou
Messages: 76
Registered: November 2010
Member
On 10/26/2011 07:02 PM, David Fanning wrote:
>>
>> Maybe there is an IDL equivalent to the ENVI "Build mask from a ROI" tool?
>
> I wouldn't worry about it. I'd put my polygon
> into an IDLanROI object and use the ComputeMask
> method to create the mask. I'm pretty sure this
> is exactly what ENVI does, or pretty close to it. :-)
>

Wow, I am just starting to realize that this IDLanROI object is going to
change a lot of things in my programs!

But, as far as I understand the documentation, it only stores one
entity. So, if I have many entities (often the case in my shapefiles), I
have to instance many IDLanROI objects, generate a mask for all of them
and then combine the masks together? Or did I miss something again?

Thanks!
Re: Shape to raster [message #78138 is a reply to message #78123] Wed, 26 October 2011 10:02 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Fabzou writes:

> My apologies if this question has been posted before.
>
> I have a polygon vector file from which I know the coordinates within a
> grid (subpixel precision) and I would like to make a mask from this
> information (within the polygon = 1, outside = 0).
>
> The only idea I have to make this would be to use the polyfill command
> and use the produced image as a mask. This would be easy to do, but I am
> worried about the precision I would reach by doing so (I am concerned
> about the line thickness, for example, and all the things that make of
> POLYFILL and DRAW_ROI a plot routine and not a "shape to raster" routine).
>
> Maybe there is an IDL equivalent to the ENVI "Build mask from a ROI" tool?

I wouldn't worry about it. I'd put my polygon
into an IDLanROI object and use the ComputeMask
method to create the mask. I'm pretty sure this
is exactly what ENVI does, or pretty close to it. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Shape to raster [message #78180 is a reply to message #78117] Mon, 31 October 2011 07:18 Go to previous message
Fabzou is currently offline  Fabzou
Messages: 76
Registered: November 2010
Member
Hi again,

On 10/27/2011 02:30 PM, David Fanning wrote:
> Fabzou writes:
>> But, as far as I understand the documentation, it only stores one
>> entity. So, if I have many entities (often the case in my shapefiles), I
>> have to instance many IDLanROI objects, generate a mask for all of them
>> and then combine the masks together? Or did I miss something again?
>
> No, you can do all this with one IDLanROI object. Simply
> use the MASK_IN keyword to the Compute_Mask method to
> pass in and modify the mask from previous polygons.

I ended up using IDLanROIgroup. It crashes (fatal error!) when there are
too many entities (thousands of them) but this was just for a test and
everything works fine in "normal" cases.

I have an other question though. How will the IDLanROI object
"understand" the XY coordinates [0.5,0.5]? In my conception, these
coordinates correspond to the center of the first down left pixel, but
my first tests tend to show that this may not be the case...

Thanks!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ENVI Navigating GeoTiff Image Incorrectly?
Next Topic: Re: unable to set time attribute for netCDF in IDL

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

Current Time: Wed Oct 08 13:37:51 PDT 2025

Total time taken to generate the page: 0.00617 seconds