I've got a strange one for you folks. Working with some address points and parcel polygons, is it possible to get the x and y geometry from a centroid of an intersecting polygon?
I followed this documentation and the way the author's script works great when replicating the author's scenario. Yet when I try to get the centroid of a polygon I get an error 'Expected convertable to geometry'.
Basically, I'm trying to update the geometry of a point on intersect based on the centroid geometry of the intersecting polygon
//This calculation attribute rule is added to the shape field of a point feature $feature
var parcels = Intersects(FeatureSetByName($datastore, "Parcel", ["*"], true), $feature)
var parcelCentriod = Centroid(parcels)
if (!IsEmpty(parcelCentriod)) {
var x0 = Geometry(parcelCentriod).x
var y0 = Geometry(parcelCentriod).y
var addressPoint = Point({
"x": x0,
"y": y0,
"z": 0,
"spatialReference": Geometry(parcelCentriod).spatialReference
});
return addressPoint
}
return{
"errorMessage": Text('Something Went Wrong')
}