Hello,
I am running into an issue in ArcGIS Pro that I have been able to resolve in the past using repair geometry, but not on this particular feature class. The script is used to create a unique id for our utilities feature classes by combining ObjectID, Half Section, and utility type.
I am running this expression in a field calculation, but it will be used as a attribute rule.
Any help is appreciated.
// SAN POINTS QA/QC | UPDATE NETWORK ID
var f = $feature.Feat_Code
var o = $feature.Functn
var oid = $feature.OBJECTID
// HALF-SECTION //
// Get the intersecting "HalfSection" polygon
var hs = FeatureSetByName($datastore, "HalfSection");
// Intersect current feature with HalfSection polygons
var h = First(Intersects(hs, $feature));
// Create a buffer (1000 feet)
var buff = Buffer(Geometry($feature), 1000, 'feet');
// Get candidate HalfSections within buffer
var candidates = Intersects(hs, buff);
// Initialize nearest tracking
var nearestHS = null;
var minDist = 999999999;
// Loop through candidates to find closest HalfSection
for (var feat in candidates) {
var d = Distance(Geometry($feature), Geometry(feat));
if (d < minDist) {
minDist = d;
nearestHS = feat;
}
}
var halfSec;
// If an intersecting polygon is found, use its "HalfSec" value
if (!IsEmpty(h)) {
halfSec = h.HalfSec;
}
// If no direct intersect, but a nearby polygon exists, use closest + "xy"
else if (IsEmpty(h) && !IsEmpty(nearestHS)) {
halfSec = nearestHS.HalfSec + "xy";
}
// If nothing found, set to null
else {
halfSec = null;
}
// Network ID Codes
var n = decode(f,
'XC San Manhole', 'SAMH',
'Sanitary Manhole', 'SAMH',
'Sanitary - TW', 'SATW',
'San Service Stub', 'SASS',
'Pipe End', 'SAPE',
'Nolocate', 'SANL',
'MIA', 'SAMA',
'Metro San MH', 'SAMM',
'Meter Station', 'SAMS',
'Manhole Drop Line', 'SAMH',
'Lift Station', 'SALS',
'Gate Valve', 'SAGV',
'Flushing Connection', 'SAFC',
'Curb Stop', 'SACS',
'Crossover','SAXX',
'CP Test','SACP',
'Cleanout', 'SACO',
'Air Release MH', 'SAAR',
null)
// Final Network ID
var ni = n+"-"+halfSec+"-"+oid
return ni