Hey,
Is it possible to automatically transfer an attribute value from a line to a component when attaching the line to the component using an attribute rule?
Kind regards
Solved! Go to Solution.
Yes - you can do this using an intersection of the two features
It really depends on how you are doing it, but you can use a dictionary to make the final field/fields update:
So something like this:
//first get the intersecting grid
var gridNo = FeatureSetByName($datastore, "LAND_Grid", ["GRIDNO"], false);
var intersectingGrid = first(intersects(gridNo, $feature));
var seqNo = NextSequenceValue("SeqManholes");
var depotArea = FeatureSetByName($datastore, "LAND_DepotArea", ["DEPOTAREA"], false);
var intersectingDepot = first(intersects(depotArea, $feature));
return{
"result" : {
"attributes" : {
"FACILITYID" : "MH-" + intersectingGrid.GRIDNO + "-" + seqNo,
"DEPOTAREA" : intersectingDepot.DEPOTAREA,
}
}
}
Yes - you can do this using an intersection of the two features
I would say "Yes", but depending on what you are doing will determine the best way to do it. For me, I have the rule on the point feature, and I take an attribute from the intersecting feature (a polygon) and get the attribute value from the polygon this way.....then just add it to the point.
var depotArea = FeatureSetByName($datastore, "LAND_DepotArea", ["DEPOTAREA"], false);
var intersectingDepot = first(intersects(depotArea, $feature));
This will add the value of the depotArea field to the feature. This triggers when the feature is created.
Thank you very much for the answers.
I have adjusted the expression for my purpose. However, it does not fill the field or update it. How can I update the value or should it update automatically?
Here is my intention:
The address point has the attribute field called "Wohneinheiten". When connecting a cable to this address point, the value from "Wohneinheiten" should be overwritten into the attribute field called "Info" in the cable. How can this value be updated?
It really depends on how you are doing it, but you can use a dictionary to make the final field/fields update:
So something like this:
//first get the intersecting grid
var gridNo = FeatureSetByName($datastore, "LAND_Grid", ["GRIDNO"], false);
var intersectingGrid = first(intersects(gridNo, $feature));
var seqNo = NextSequenceValue("SeqManholes");
var depotArea = FeatureSetByName($datastore, "LAND_DepotArea", ["DEPOTAREA"], false);
var intersectingDepot = first(intersects(depotArea, $feature));
return{
"result" : {
"attributes" : {
"FACILITYID" : "MH-" + intersectingGrid.GRIDNO + "-" + seqNo,
"DEPOTAREA" : intersectingDepot.DEPOTAREA,
}
}
}
Where can I find the geometry of the cable and the address point? Do I need to create a geometry field for each respective feature, or is the geometry stored somewhere else? If I do need to create a geometry field, what field type should I use for it?
Kind regards