Select to view content in your preferred language

Intersect with the center of a polygon

219
1
Jump to solution
09-09-2024 09:11 AM
IanLadd_Tourmaline
Regular Contributor

I have a lot of 250m square polygons, and I want to add the location based on a grid I have to an attribute table field. How do I set the intersection to use the center of the polygon? I've noticed sometimes it pulls the grid location from the upper left of the 250m polygon, but I want it to use the center.

Example image below, it populated it with B-55, but it should be C-45

IanLadd_Tourmaline_0-1725898255135.png

 

 

var land = FeatureSetByName($datastore,"Grid_BC_IHS_NTS_QTR_TH_NR_27",["QTR_UNIT","UNIT","BLOCK","SHEET","LQ","PQ"], true)
var intersectLayer = Intersects(land, Geometry($feature))
if (Count(intersectLayer) > 0) {
for (var layer in intersectLayer) {
return layer.QTR_UNIT+("-")+layer.UNIT+("-")+layer.BLOCK+("/")+layer.PQ+("-")+layer.LQ+("-")+layer.SHEET;
}
} else {
return null;
}

0 Kudos
1 Solution

Accepted Solutions
CodyPatterson
Frequent Contributor

Hey @IanLadd_Tourmaline 

I know this isn't a direct answer to your question, but you can use the Feature To Point tool that will create a point at the direct center of the polygon, which you can then use to run your tool, I used this on a similar issue where the center of a polygon was very important.

Cody

View solution in original post

0 Kudos
1 Reply
CodyPatterson
Frequent Contributor

Hey @IanLadd_Tourmaline 

I know this isn't a direct answer to your question, but you can use the Feature To Point tool that will create a point at the direct center of the polygon, which you can then use to run your tool, I used this on a similar issue where the center of a polygon was very important.

Cody

0 Kudos