IMAGINE Discussions

Discuss and share topics of interest using ERDAS IMAGINE the world’s leading geospatial data authoring system.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Occasional Contributor
Posts: 7
Registered: ‎05-29-2019
Accepted Solution

How to devolve polygons into points?

Hello,

 

I need to devolve my test area (training) polygons into points in order to create more samples for a Random Forest classifier. I have not had any success figuring out how to do this in ERDAS IMAGINE and I wondered if it is even possible. I assume that the process uses the raster to assign one point for every pixel that falls within the polygon area?

 

I am grateful for any advice you might have.

 

Thank you very much.

 

Sarah

Highlighted
Frequent Contributor
Posts: 112
Registered: ‎01-20-2016

Re: How to devolve polygons into points?

Hi sarahs

 

apply the Create Random Points operator!

It's easy to use.

 

Ruth

 

 

Highlighted
Technical Evangelist
Posts: 1,010
Registered: ‎10-01-2015

Re: How to devolve polygons into points?

Hi @sarahs 

 

As Ruth says, Create Random Points is the easiest route to go and what I often use for Random Forest classification.

 

If you want to extract a point for every pixel though, I use a variant of the Dice approach:

 

https://community.hexagongeospatial.com/t5/Spatial-Modeler-Tutorials/Autogrid/ta-p/36565

 

...set to grid every pixel (or you could sample every nth pixel) and convert to a center point (and keep just the points that fall within the original training polygons). I should probably write it up as a Spatial Recipe one of these days, if people are interested? Id also recommend logging an Idea asking for a specific function to convert pixels to points.

 

Cheers

 

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Highlighted
Occasional Contributor
Posts: 7
Registered: ‎05-29-2019

Re: How to devolve polygons into points?

Dear @Ruth and @ian.anderson,

 

Thank you very much for your responses, I am grateful. I am attempting to implement both methods that you suggest so that I learn as much as possible from your answers.

 

I have run into difficulty implementing the Create Random Points function. I am accessing this under Accuracy Assessment but before it will allow me to create random points it looks like I must first open a classified image (otherwise the create random points function is greyed out). I haven't yet performed my classification as I'm devolving my training polygons into points as inputs to a RF classifier. Is there a way to implement the Create Random Points function without using a classified image?

 

I am also working on the Dice method, but I first need to get my head around the Spatial Modeler (which I've never used before) so it will be a little while longer before I can confirm that this method has worked for me. Ultimately, I think I will need to use this method as I want to maximise the number of points within my polygons by having a point generated for every pixel, but I also want to ensure that no pixel contains more than one point.

 

Sincerest thanks,

 

Sarah

 

 

Highlighted
Technical Evangelist
Posts: 1,010
Registered: ‎10-01-2015

Re: How to devolve polygons into points?

Hi @sarahs ,

 

I think @Ruth was referring to the Spatial Modeler as well - the Create Random Points operator:

 

random.PNG

 

If you are new to Spatial Modeler you might want to check out the eTraining courses here:

 

https://community.hexagongeospatial.com/t5/Spatial-Modeler-eTraining/tkb-p/eTSpatialModeler

 

...and expand the Courses listing at upper right to see what's available.

 

Cheers

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Highlighted
Technical Evangelist
Posts: 1,010
Registered: ‎10-01-2015

Re: How to devolve polygons into points?

This is the approach I took when I wanted to create a "regular" array of points for all non-background pixels:

 

point_per_pixel.PNG

 

You could easily modify that bottom leg of the model to take in your training polygons and select just the pixel locations that fall within them. Then use those points with the Add Attributes by Location operator to collect the training values for Machine Learning.

 

Cheers

 

 

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Highlighted
Occasional Contributor
Posts: 7
Registered: ‎05-29-2019

Re: How to devolve polygons into points?

Dear @ian.anderson,

 

This is so helpful, thank you. Unfortunately I have realised that I have an insufficient number of pixels (samples) to pursue a RF classification so I won't be taking this approach further for this project. But I'm grateful to know about the current options for devolving polygons into points and for assigning points to pixels in a raster.

 

Thank you very much for your help, I am most grateful.

 

Sarah