Skip to main content

The question is pretty self-explanatory, there is a select by location option in ArcMap that allows you to select polygons from a dataset that have their centroid in polygons from ANOTHER DATASET. I think one would need to use the CenterPointReplacer transformer to create centroids of the polygon and select the centroids that are within the other polygon then join (DatabaseJoiner?) the selection back to the original polygon but I would like to know if there is an easier way.

You could try this:

So from the polygons, replace all by its center point.

Load both polygons and center points to a PointOnAreaOverlayer.

Test the points for more than 1 overlap.


You could try this:

So from the polygons, replace all by its center point.

Load both polygons and center points to a PointOnAreaOverlayer.

Test the points for more than 1 overlap.

This looks like what I have already, the exception is, for PointOnAreaOverlayer Transformer the Area is coming from another reader polygon (Polygon2) because I need to find out if the centroids from polygons from one feature class (Polygon1) is inside a different polygon(Polygon2), not the one I originally created the centroids from. The thing this doesn't take into account is that I don't actually want the centroids for my end product, I want to have the polygons that have their centroid inside Polygon2 selected. The method above creates the centroids but doesn't link them back to the polygons they were derived from.

 

 


You could try this:

So from the polygons, replace all by its center point.

Load both polygons and center points to a PointOnAreaOverlayer.

Test the points for more than 1 overlap.

I didn't notice that you chose the CenterLineReplacer transformer, is that intentional?

 

 


I didn't notice that you chose the CenterLineReplacer transformer, is that intentional?

 

 

No, that is a mistake. Should be the CenterPointReplacer.

 

 


You could try this:

So from the polygons, replace all by its center point.

Load both polygons and center points to a PointOnAreaOverlayer.

Test the points for more than 1 overlap.

Ok, after looking at yours and rethinking a bit, here is what I have constructed:

selectarkypolygons-that-havecentroids-inside-green.png

You can see that there has been ONE more polygon selected when I apply the second PointOnAreaOverlayer to extract the polygons matching the selected centroids. The problem with using the PointOnAreaOverlayer transformer for the polygon re-selection is that it may (I have to check my outputs) be selecting more polygons than necessary because a centroid of one polygon may overlap a polygon that shouldn't be selected(doesn't have centroid in). This is why I would rather create a join between the centroid selection and the original Arky_Polys by a Unique_ID field and then create a polygon output from that selection but I can't find one that can join and select properly. How can I select the Arky_Polys that match the attributes from the centroid selection?


I would use a Counter (ID)-> GeometryExtractor -> CenterPointReplacer -> SpatialRelator (attributes that must differ the ID from the counter) -> GeometryReplacer.


I would use a Counter (ID)-> GeometryExtractor -> CenterPointReplacer -> SpatialRelator (attributes that must differ the ID from the counter) -> GeometryReplacer.

If there is already an attribute that is a UniqueID do I need to have the counter transformer? What am I using the GeometryExtractor Transformer for?

 

 


If there is already an attribute that is a UniqueID do I need to have the counter transformer? What am I using the GeometryExtractor Transformer for?

 

 

No you do not.

 

 


No you do not.

 

 

The generate list on the SpatialRelator is also optional (if you want to know *which* polygons the centroid fall inside).

 

 


I would use a Counter (ID)-> GeometryExtractor -> CenterPointReplacer -> SpatialRelator (attributes that must differ the ID from the counter) -> GeometryReplacer.

I think the issue here is the same as the other answer, I'm not trying to find the polygons that have their centroids in another polygon from the same dataset but from a different dataset entirely.

 

 


Ok, after looking at yours and rethinking a bit, here is what I have constructed:

selectarkypolygons-that-havecentroids-inside-green.png

You can see that there has been ONE more polygon selected when I apply the second PointOnAreaOverlayer to extract the polygons matching the selected centroids. The problem with using the PointOnAreaOverlayer transformer for the polygon re-selection is that it may (I have to check my outputs) be selecting more polygons than necessary because a centroid of one polygon may overlap a polygon that shouldn't be selected(doesn't have centroid in). This is why I would rather create a join between the centroid selection and the original Arky_Polys by a Unique_ID field and then create a polygon output from that selection but I can't find one that can join and select properly. How can I select the Arky_Polys that match the attributes from the centroid selection?

This is where @jdh is using the GeometryExtractor (saves the geometry definition in an attribute) and GeometryReplacer (gets the saved geometry definition from the attribute and re-creates the geometry, in your case the original polygon).

 


I think the issue here is the same as the other answer, I'm not trying to find the polygons that have their centroids in another polygon from the same dataset but from a different dataset entirely.

 

 

Then just have the Supplier port of the SpatialRelator coming from the other dataset.

 

 

If there are no identical polygons between the datasets, you can ignore the setting "attributes that must differ"
This is where @jdh is using the GeometryExtractor (saves the geometry definition in an attribute) and GeometryReplacer (gets the saved geometry definition from the attribute and re-creates the geometry, in your case the original polygon).

 

That makes sense, I think I get what you guys are saying.

 

 


Thanks for all your help @erik_jan and @jdh. I have since modified my workflow to include the GeometryExtractor and Replacer (this was the key actually) so that I could run my selection of centroids derived from the original polygons and then turn those selected points back into their corresponding polygons. Here is what I did if anyone needs to do something similar.

selectpolygons-that-havecentroids-in-another-polyg.png

Thanks again! :)


Reply