Skip to main content

I have two inputs, a polygon shape file and a point shape file. The polygon shape file contains two area polygons, A and B. Each has a single, name attribute - A and B respectively. The point file contains 30 points and they also have a single name attribute, with attribute values ranging from A to E. Some of these points fall inside the polygons and others do not.

As a rule, polygon A must only contain two A points and one E point while polygon B must only contain two B points and one E point.

I input both shapefiles into PointOnAreaOverlayer transformer which filters out all points falling outside of the polygons. Within this transformer, I generate an attribute accumulation list on the Area outputs, with the selected attribute set to 'name'.

Using listElementCounter, I can see if the correct number of points fall in each polygon - in this case 3. Using ListConcatenator, I can create an attribute listing the names of the points that fall in to the polygon, eg- A, A, E.

I can then use Testers to verify if polygon A as the correct three points with IDs A, A and E, and similar for polygon B (B, B, E).

However, I think I may be overcomplicating the procedure. I initially thought of using SpatialRelator, but couldn't figure out how to analyse if the correct point configuration was in each polygon. Any thoughts on my methodology or suggested improvements would be most welcome.

 

You can analyse the list by using the ListHistogrammer. That will give you a list with the number of each type of point. It would be simple to test if the first element in the histogram has a count of 2 and a value of either A or B.


I would add uuidgenerator to area before pointonareaoverlayer (or use globalID); then replace listelementcounter with listexploder then tester testing where [name = 'polygon A' and (id = 'A' or id = 'E') or name = 'Polygon B' and (id='B' or id = 'E')] next add statistics calculator--GroupBy @Value(_uuid), @Value(name) & @Value(id) and run stats on id collecting 'total count'. Finally tester [(id.total count='2' and(id='A' or id='B') or (id.total count = 1 and id='E')] All left overs will be the ones with more or less than rule established.

 

Supplying sample data would make this comment less of a run-on sentence.


Reply