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
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;
}
Solved! Go to Solution.
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
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