Skip to main content
Solved

Add point attributes (or Raster) to a Polygon


dilip
Contributor
Forum|alt.badge.img+2
  • Contributor
Hi All,

 

 

Thanks for your answers, still having trouble with this, basically what i am trying to do is the following.

 

 

1. Land Parcel polygons are generated from sub meter imagery by digitising the polygons.

 

 

2. Crop Classification is carried out using Photo Interpretation and manually added. I can either use Erdas or ArcMap to collect a rapid raster classification layer, but how to get the information into the polygon dataset is difficult. For Example:

 

 

Image 1. Shows the polygons over a reclassed NDVI Extract showing Green-Good Crops Vigour, Yellow-Moderate Crop Vigour, Red-Poor Crop Vigour.

 

 

 As you can see, if I convert the Raster to Points, I can extract the Information I need, but it only selects the last point it reads, there could be many points in each polygon, what I need to do is look at the majority points of the same value, and then add that value to the polygon, the same applies to the above original question.

 

 

The idea is to select all points in a polygon, add the value of the majority of points, So if a polygon had 10 points in it, 7 had a value of 3, 2 with a value of 2 and 1 with a value of 1, the polygon will get the majority value, which would be 3.

 

 

I hope this helps everyone understand what I need to do, as always all the help is very much appreciated.

 

 

?Many thanks in advance.

Best answer by takashi

Hi,

 

 

There are several ways.

 

I would use the Clipper and the StatisticsCalculator since you have already transformed the raster into points.

 

Assuming that each polygon have a unique identifier attribute (e.g. "polygon_id").

 

(1) Merge "polygon_id" to inside points for each polygon by a Clipper.

 

Send the polygons to the Clipper port; send the points to the Clipee port.

 

Accumulation Mode: Merge Clipper

 

(2) Connect a StatisticsCalculator to the Inside port of the Clipper to calculate the required statistics value for each polygon. I suppose that "the value of the majority points" means the "mode".

 

Group By: polygon_id

 

Attributes to Analyze: <select attributes that you need to analyze>

 

(3) Merge the features which will be output from the Summary port of the StatisticsCalculator to the original polygons with a FeatureMerger, joining on "polygon_id".

 

 

Takashi
View original
Did this help you find an answer to your question?
<strong>This post is closed to further activity.</strong><br /> It may be a question with a best answer, an implemented idea, or just a post needing no comment.<br /> If you have a follow-up or related question, please <a href="https://community.safe.com/topic/new">post a new question or idea</a>.<br /> If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • March 24, 2015
You can use a SpatialRelator to aquire all points within a polygon. Use a GroupBy polygon_ID (create one if this is missing, you can use a counter for that).

 

You can then, for instance, use a ListHistogrammer on the relevant attribute in he "_related_candidates" list.

 

Sort using a listsorter and pick the highest using a listindexer.

 

 

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • March 24, 2015
If u want to use the raster instead.

 

U can clip the raster by the polygons. To groupBy Polygon_id, there are 2 options.

 

One is a loop, the other is coppying the raster.

 

For this you can refer to a forum issue (i think last mont about using AreOnArea in a group by strategy)

 

After you cliped them you can use rasterto plygon. Then calculate largest are, you can use StatisticsCalculator in a goupBY, grouped by the NDVI.

 

 

Also possible of course is to do rastertopolygon conversion first and then use a areaonArea overlay with grouping strategy.

takashi
Evangelist
  • Best Answer
  • March 26, 2015
Hi,

 

 

There are several ways.

 

I would use the Clipper and the StatisticsCalculator since you have already transformed the raster into points.

 

Assuming that each polygon have a unique identifier attribute (e.g. "polygon_id").

 

(1) Merge "polygon_id" to inside points for each polygon by a Clipper.

 

Send the polygons to the Clipper port; send the points to the Clipee port.

 

Accumulation Mode: Merge Clipper

 

(2) Connect a StatisticsCalculator to the Inside port of the Clipper to calculate the required statistics value for each polygon. I suppose that "the value of the majority points" means the "mode".

 

Group By: polygon_id

 

Attributes to Analyze: <select attributes that you need to analyze>

 

(3) Merge the features which will be output from the Summary port of the StatisticsCalculator to the original polygons with a FeatureMerger, joining on "polygon_id".

 

 

Takashi

dilip
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • March 30, 2015
Hi Takashi,

 

 

I owe you a drink, this is just what I needed as it can be validated as well, very many thanks

 

 

Dilip

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings