Hey folks,
Stumbled upon this post, Advanced Attribute Rules - Editing features on another class with attribute rules where inserting a point created a buffer polygon feature class. I wanted to use this when a user creates an annotation feature a similar rule would create a point feature class. When I use almost identical code just pointed to a point feature class.
var featureGeo = Geometry($feature);
return {
"result": $feature.OBJECT__ID,
"edit": [
{
"className" : "LocalPoints",
"adds" : [
{
"attributes":
{
"TextString": $feature.TextString
},
"geometry": featureGeo
}
]
}
]
}
I get the following error..
Am I using the wrong function to return the annotation feature geometry? Or is it my Pro Version? 2.6.6
Any help for this noob is appreciated!
~j
Solved! Go to Solution.
Annotation features seem to be treated as polygons. So when you try to just copy the geometry to a point fc, it throws an error.
Depending on where you want the point to show up, you have a few options:
Annotation features seem to be treated as polygons. So when you try to just copy the geometry to a point fc, it throws an error.
Depending on where you want the point to show up, you have a few options:
Johannes,
Always looking out for me!
I did try Centroid() prior to posting, I get the following error:
Using featureGeo.rings[0][1] returns this error:
After these attempts, your statement "Annotation features seem to be treated as polygons." got me thinking so when I did the following, I got the desired output!
var buff = Buffer($feature,1)
var featureGeo = Centroid(buff)
Creating a small buffer then getting the centroid did the trick!
Thank you for your help. As always its a pleasure!
This also worked......
var featureGeo = Geometry($feature);
var featureGeo = Centroid(featureGeo)
Huh, weird, these snippets worked for me. But my test feature classes are in a file gdb, maybe that makes a difference, who knows...
Glad you got it to work with the buffer!
Yeah, not sure. Enjoy the day!