|
POST
|
The difference is to determine whether the segment is angled upwards or downwards.
... View more
04-08-2025
08:05 AM
|
0
|
0
|
1460
|
|
POST
|
Hi, I am having trouble with the arcade script below being used in an attribute rule that is designed to adjust the building footprints using the code below. It validates, but when it runs, the vertices do not change and I am not sure how to return the modified geometry. The script below primarily works with rectilinear polygons, and it will be modified later to check and update each segment so that all segments that it enforces collinear and parallel lines. function GetThirdVertex(NPoint, a, m, d){
var np = Dictionary( NPoint )
//console( np )
// Solve for possible x2 and y2 coordinates
var deltaX = d / sqrt(1 + pow(m,2))
var deltaY = m * deltaX
// Compute the two possible vertices
if( a > 0 && a < 180 ){
np.x = np.x + deltaX
np.y = np.y + deltaY
}
else{
np.x = np.x - deltaX
np.y = np.y - deltaY
}
//console( np )
// Return an array containing the two possible vertices
return Point( np )
}
// Function to get unique slopes in the array of points
function ValidateSlopes( InputArray ){
var Slopes = []
for( var i=0; i<Count(InputArray)-1; i++ ){
var A = InputArray[i]
var B = InputArray[i+1]
var m = Round((A.x-B.x)/(A.y-B.y),2)
Push( Slopes, m )
}
var ConvertSlopes = {}
if( Count( Slopes ) % 2==0 ){
var A = Null; var B = Null
for( var i=0; i < Count(Slopes) - 1; i++ ){
if( IsEmpty( A ) && IsEmpty( B ) ){ A = Slopes[i]; B=Slopes[i+1] }
else{
if( A == Slopes[i] && B != Slopes[i+1] ){ ConvertSlopes[ Text( Slopes[i+1] ) ] = B }
else if( A != Slopes[i] && B == Slopes[i+1] ){ ConvertSlopes[ Text( Slopes[i] ) ] = A }
}
}
}
return ConvertSlopes
}
function Slope(A,B){ return Round( (A.x-B.x)/(A.y-B.y), 2 ) }
var Geo = Geometry( $feature )
var SR = Geo.spatialReference
var NewRings = []
var Rings = Geo.Rings
for( var R in Rings ){
var Ring = Array(Rings[ R ])
var VSlopes = ValidateSlopes(Ring)
var NewRing = [Ring[0],Ring[0]]
for (var i = 0; i < Count(Ring) - 1; i++) {
var p1 = Ring[i]
var m = Slope( Ring[i], Ring[i+1] )
if( HasKey( VSlopes, Text(m) ) ){ m = Text(m); m = VSlopes[m] }
var A = Angle( Ring[0],Ring[1] )
var d = Round( Distance( Ring[i],Ring[i+1] ), 1 )
var NewPnt = GetThirdVertex( p1, A, m, d )
Insert( NewRing , i+1, NewPnt )
}
Push( NewRings , NewRing )
}
Rings = NewRings
// Output adjusted coordinates
var NewGeom = {
'rings': Rings,
'hasM': False,
'hasZ': False,
'spatialReference': SR
}
return Geometry( NewGeom ) I have tried several things to modify the existing geometry but still no luck. I did it before but now I cannot seem to remember how exactly I did it.
... View more
04-07-2025
12:57 PM
|
0
|
4
|
1509
|
|
POST
|
I tried doing the same things you did and was told repeatedly that you cannot despite that it is common in other programming languages. I am also a heavy python user and so it sometimes gets me when somethings work in python that don't necessarily translate well in arcade.
... View more
04-03-2025
12:27 PM
|
0
|
1
|
1905
|
|
POST
|
Hi @WardMitchell2, A general rule of thumb, and even Esri has stated this, is that using alphanumeric IDs is generally unwise given that there is no method to accurately sort or filter those particular IDs. That being said, in your code you are trying to reference the name of the feature class when using FeatureSetByName. You have to explicitly use the name, like in the example below. var F = FeatureSetByName( $datastore, 'This.Is.My.Feature.Class",['*']) It will not work otherwise. There is documentation that you can lookup that verifies this.
... View more
04-03-2025
09:12 AM
|
0
|
0
|
1935
|
|
IDEA
|
You can easily run a bat file that logs whenever something runs or fails. There are plenty of examples in the web which I have used in the past when running scripts. Sometimes tools can get hung up in pro which is a typical frustration that some encounter.
... View more
04-03-2025
09:04 AM
|
0
|
0
|
1338
|
|
IDEA
|
Hi @SStopyak_BruceHarris, All tasks scheduled in pro are scheduled in Task Scheduler. If you need to modify the schedule then it is best to do it in the task scheduler after it is created.
... View more
04-03-2025
06:13 AM
|
0
|
0
|
1364
|
|
POST
|
Sorry there was a script typo. I was using a different IDE outside of the Arcade and noticed that a couple of lines were missing a bracket. var Fields = [
{ 'name':'TreeSpecies' , 'type': 'esriFieldTypeString' , 'length':50 },
{ 'name':'Score' , 'type': 'esriFieldTypeInteger' },
]
var TreeNames = {
'Weraiti':0,
'Yeogi':0,
"Yunnan":0,
"Booth":0,
"Awanui":0,
"Aegyptica":0,
"Gigantea":0,
"Glenmark":0
}
Expects($feature,'*')
var Values = []
for( var N in TreeNames ){
var V = { 'TreeSpecies' : N , 'Score': $feature[ N ] }
Push( Values , {'attributes': V } )
}
var TreeScores = {
'fields' : Fields,
'geometry':'',
'features': Values
}
TreeScores = FeatureSet(Text(TreeScores))
TreeScores = Top(OrderBy(TreeScores,'Score'+'Desc'),5)
var M = ''
for( var row in TreeScores){
M = M + Text(row.TreeSpecies) + ' has ' + Text(row.Score)+TextFormatting.NewLine
}
Console( M ) If you are using the arcade playground to test things then this code will need to be reconfigured to whatever test data your are trying to use.
... View more
04-03-2025
04:14 AM
|
0
|
0
|
3548
|
|
POST
|
Hi @Gabrielle_Byczek, The best approach to updating either the feature class/table would be to utilize attribute rules or run a field calculation using Arcade to update the information. There are several arcade functions out there that will help with identifying ways to populate other features.
... View more
04-02-2025
10:44 AM
|
0
|
0
|
506
|
|
POST
|
Another method is to make a simple featureset and use the orderby and top methods to get the top 5 var Fields = [
{ 'name':'TreeSpecies' , 'type': 'esriFieldTypeString' , 'length':50 },
{ 'name':'Score' , 'type': 'esriFieldTypeInteger' },
]
var TreeNames = {
'Weraiti':0,
'Yeogi':0,
"Yunnan":0,
"Booth":0,
"Awanui":0,
"Aegyptica":0,
"Gigantea":0,
"Glenmark":0
}
Expects($feature,'*')
var Values = []
for( var N in TreeNames ){
V = { 'TreeSpecies' : N , 'Score': $feature[ N ]
Push( Values , {'attributes': V )
}
var TreeScores = {
'fields' : Fields,
'geometry':'',
'features': Values
}
TreeScores = FeatureSet(Text(TreeScores))
TreeScores = Top(OrderBy(TreeScores,'Score'+'Desc'),5)
var M = ''
for( var row in TreeScores){
M = M +'${row.TreeSpecies} has ${row.Score}'+TextFormatting.NewLine
}
Console( M )
... View more
04-02-2025
05:43 AM
|
0
|
2
|
3617
|
|
POST
|
Hi @MarcyC, If you are using field maps in agol then you would simply need to do a calculated expression for that field. Which would look like the steps below: Create the new arcade expression to look like the one below var edit = $editcontext.editType
var ShapeArea = $feature.Shape__Area
var CalcArea = 0
if( edit == 'INSERT'){
//if area is in sq ft
CalcArea = ShapeArea*0.0000229569
//if area is in sq meters
CalcArea = ShapeArea*0.00024711
}
return CalcArea For line lengths you can use the same approach.
... View more
04-01-2025
11:36 AM
|
0
|
1
|
3688
|
|
POST
|
You can make edits to them simultaneously because the features are in different datasets using different versions. To clarify, if a feature class in a dataset is versioned using traditional then the other feature classes in the same dataset cannot be set to batch. If there are feature classes in the same database but in separate datasets with one using traditional versioning methods and another using batch then both features can still be edited.
... View more
04-01-2025
09:25 AM
|
2
|
0
|
1613
|
|
POST
|
It is possible to use both branch and traditional but it mostly depends of how the datasets and/or feature classes are set up. You can have one set of features outside a dataset use a different editing version than features within a dataset. You can't edit simultaneous features within a dataset using different versioning methods.
... View more
03-31-2025
07:18 AM
|
0
|
2
|
1655
|
|
POST
|
So it is best to keep it in the same database, or if needing to manage it separately, have a sql job only push copies to that database. Reasons being are as follows: Having all features in the same dataset or having a sql job that only updates a table with specific attributes will allow for you to utilize attribute rules. Otherwise a tool. process, or script will be needed to update certain attributes if those attributes are derived from the parcel layer. In addition to the answer above, if there are certain criteria that has to be met, such as automatic easements, identifying whether something is public or private, or any combination of things then it would be best to keep everything in the same database. As for versioning, it all depends on the direction you plan on taking, branch works best if you are using small datasets and have a strong network connection, otherwise you will need to use the traditional versioning method. Any layers in a non-dataset do not have to be versioned unless there is a single layer in the non-dataset is versioned in which case the entire dataset will be versioned. Ideally you want to separate out your non-versioned feature classes and/or tables so that any non-versioned data is stored separately.
... View more
03-28-2025
04:52 AM
|
2
|
4
|
1783
|
|
POST
|
I don't quite know myself but I assume that it is limited by the extent of the features. I don't know if, when using the intersect, it considers the extent of all input features or if it merely defines the extent by the union of the features in the result of the intersect.
... View more
03-27-2025
12:02 PM
|
0
|
3
|
1905
|
|
POST
|
To add to @AustinAverill. If the facilities are identical/share a common location, then your code will only return one facility. If there are multiple facilities and you are trying to only determine the feature's facility that it corresponds with, then the code you have writing would be overly complicated for the implementation. With that being said, if you are looking to identify which facility a feature should belong to given certain criteria then that would have a different result than the one you are looking for. A simpler way to get a list of all facilities and identify the likeliest candidate would look like the code below. function GetFacilityName( InFeature , FieldName , FilterValue , AcquireField, DictOfValues ){
var Value = Filter( InFeature , FieldName + ' = @FilterValue' )
if( !IsEmpty( Value ) ){ Value = First( Value )[ AcquireField ] }
var TValue = Text( FilterValue )
if( TypeOf( DictOfValues ) == 'Dict' && HasKey( DictOfValues , TValue ) ){ Push( DictOfValues[ TValue ] , Value ) }
else{ DictOfValues = Dictionary( TValue , [ Value ] ) }
return DictOfValues
}
var facilityfs = FeatureSetByRelationshipName($feature, "TX_ALL_FACILITIES", ['FAC_NAME', 'FAC_ID'], false)
var wellfs = FeatureSetByRelationshipName($feature, "TX_GMH_OILGAS_WELLS", ['LEASE_NAME','FAC_ID'], false)
var pipelinfs = FeatureSetByRelationshipName($feature, "TX_PIPELINE_POINTS_ALL", ['FAC_NAME', 'FAC_ID'], false)
var FacilID = $feature.FAC_ID
var FacilName = GetFacilityName( facilityfs, 'FAC_ID', FacilID, 'FAC_NAME', None )
FacilName = GetFacilityName( wellfs, 'FAC_ID', FacilID, 'LEASE_NAME', FacilName )
FacilName = GetFacilityName( pipelinfs, 'FAC_ID', FacilID, 'FAC_NAME', FacilName )
var Name = Null
var TID = Text( FacilID )
if( HasKey( FacilName , TID ) ){
var Names = FacilName[ TID ]
if( Count( Names ) > 1 ){ Console( '${ Names } has more than one associated facility' ) }
else if( Count( Names ) == 1 ){ Name = Names[0] }
else{ Console( 'No names match the given criteria' ) }
}
return Name Also, attribute rules can only populate a single attribute in a field that is selected/calculated by the rule. So, creating another feature would not meet the requirements to calculate that field.
... View more
03-27-2025
09:19 AM
|
0
|
1
|
1185
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 1 | 05-07-2026 01:36 PM | |
| 1 | 02-10-2026 06:09 AM | |
| 1 | 03-04-2026 01:08 PM | |
| 1 | 02-24-2026 12:59 PM |
| Online Status |
Offline
|
| Date Last Visited |
Friday
|