|
POST
|
CONTAINS 'MEDIEVAL' AND DOES NOT CONTAIN 'POST MEDIEVAL'
... View more
10-01-2021
04:46 AM
|
0
|
5
|
2191
|
|
POST
|
var output_domain = Domain($feature, "OutputField")// domain on the output field
var input_domain_code = $feature.InputField
var input_domain_description = DomainName($feature, "InputField", input_domain_code)
// if the codes of your domains are the same
return input_domain_code
// if the descriptions (what you see in the table) are the same
for(var od in output_domain.codedValues) {
if(input_domain_description == od.name) {
return od.code
}
}
return null //no matching description found
// if you need some custom mapping (eg an output_domain code corresponds
// to multiple input_domain codes), you can use a dictionary
// {input_domain_code: output_domain_code}
var domain_code_dict = {
1: 3,
2: 1,
3: 1,
4: 2,
5: 1
}
return domain_code_dict[input_domain_code] If none of these fit your needs, then I need screenshots.
... View more
10-01-2021
04:36 AM
|
0
|
2
|
6690
|
|
POST
|
Expression looks good. My guess would be that your "empty" fields aren't really empty (null or "") but have some value like " " in them.
... View more
10-01-2021
04:08 AM
|
0
|
0
|
1767
|
|
POST
|
https://developers.arcgis.com/arcade/function-reference/data_functions/#domain I'm not too sure what you're trying to do. Could you give us an example? Here are a few things I noticed: var fc = $feature // you can just call Domain($feature, ...) below.
var POC_fieldname = 'PointOfContact'
var Contact_fieldname = 'ContactInformation'
var PLdom_values = Domain(fc, POC_fieldname)
var PCdom_values = Domain(fc, Contact_fieldname)
var PL_codedVals = PLdom_values.codedValues
var PC_codedVals = PCdom_values.codedValues
// You're looping through both domains, so it will return the first
// entry of PLdom_values that corresponds to an entry in PCdom_values
// I think you want to get the PCdom_value that corresponds to the $feature's
// PLdom_value. That means only looping through PCdom_values!
// Domain.codedValues is an array of dictionaries:
// [ {"code": 1, "name": "Description"} ]
// As I said, not too sure what you want, but I guess it's more in the line of this:
var POC_description = DomainName($feature, POC_fieldname)
for(var PC in PC_codedVals) {
if(PC.name = POC_description) {
return PC.code
}
}
... View more
09-30-2021
11:26 PM
|
0
|
4
|
6693
|
|
POST
|
Other than scheduling a python script to run periodically, I know of no way to do that completely automatically. I think the Attribute Rule approach comes pretty close. All you have to do to execute it is insert a new feature or update an existing one.
... View more
09-30-2021
10:56 PM
|
0
|
0
|
4248
|
|
POST
|
There are a number of things that would be good in this scenario but aren't possible: You can't auto delete a feature after a certain time You can't run a rule on a whole table, only on features You can't run a rule on demand, only when you insert/update/delete a feature (for calculation attribute rules) So fully automated deletion won't be possible. But there are a few things that could make it easier: You cold symbolize features that are ready to delete differently using symbol property connections. For example, you could symbolize "normal" features blue and deletable features red: return IIF(DateDiff(Now(), $feature.OutageEnd, "days") >= 7, "red", "blue") You can use a python script to delete these features for you e.g. each night. You can use an Attribute Rule that fires whenever you insert or update a new feature: // Calculation Attribute rule on your feature class
// Some editable field
// Triggers: Insert, Update
// Exclude: True
// get all entries of your feature class
var fs = FeatureSetByName($datastore, "FeatureClass")
// if OutageEnd can be null, filter these values out
fs = Filter(fs, "OutageEnd IS NOT NULL")
// You could filter for the date, but the sql depends on your dbms, so I'm not going to do that. Instead, I'm going to test each feature using Arcade.
var deletes = []
for(var f in fs) {
if(DateDiff(Now(), f.OutageEnd, "days") >= 7) {
Push(deletes, {"globalID": f.GlobalID})
}
}
return {
"result": $feature.YourReturnField,
"edit": [
{
"className": "FeatureClass",
"deletes": deletes
}
]
}
... View more
09-30-2021
05:28 AM
|
0
|
2
|
4268
|
|
POST
|
I don't know if it increases the performance (although I guess the effect would be minimal in either way), but you can round: return Round((countHMO/countAddress)*100, 2)
... View more
09-29-2021
11:01 PM
|
0
|
1
|
5749
|
|
POST
|
You need to remove the return statements. If you return from a function, everything after the statement is not executed. Arcade expressions don't know of each other. You cant call $feature["countHMO"], because that calls a field that does not exist. You have to calculate countHMO & countAddress again and use them for calculating the percentage. //count multiple occupancy properties
var hmo = FeatureSetByName($map, 'Houses in Multiple Occupation HMO')
var countHMO = Count(Intersects(hmo, $feature))
//return countHMO
//count addresses
var address = FeatureSetByName($map,"CAG OldAbdn Sample")
var countAddress = Count(Intersects(address,$feature))
//return countAddress
//calculate % of multiple occupancy
return (countHMO/countAddress)*100
... View more
09-29-2021
07:56 AM
|
0
|
3
|
5766
|
|
POST
|
Ah yes, I missed the $feature in the Intersects function. Should have tested it, sorry. I edited my original reply for future reference.
... View more
09-26-2021
10:48 PM
|
0
|
0
|
2234
|
|
POST
|
Intersection takes 2 geometries as input, you use a feature set as second argument. Assuming that a parcel can intersect multiple impact areas and that impact areas do not overlap: var impact_areas = Intersects($feature, FeatureSetByName($map, 'Impact Area'))
var impacted_area = 0
for(var ia in impact_areas) {
impacted_area += AreaGeodetic(Intersection($feature, ia), 'acres')
return impacted_area
... View more
09-24-2021
12:39 AM
|
1
|
0
|
2261
|
|
POST
|
None that I know of (I know very little of the server stuff and of the python API). Maybe if you ask that as a new question, someone can tell you for sure.
... View more
09-23-2021
11:53 PM
|
0
|
0
|
4047
|
|
POST
|
for d in distinct_date_strings:
# for file geodatabases (SQL 92), the query has to look like this:
# WHERE DateField >= date '2018-09-25' AND DateField < date '2018-09-26'
# so "later than the start of this day, but before the start of the next day"
# I have "this day" in distinct_day_strings, I have to get "next day" from that
# easiest way to do that is using the datetime.datetime methods
# to do that, I have to convert "this day" from string back to datetime.datetime
# in retrospect, I would have done
# start_date = datetime.datetime.strptime(d, "%Y-%m-%d")
# but I didn't remember that method, so I did it in a more complicated way...
# d = "2018-09-25"
# d.split("-") = ["2018", "09", "25"]
# [int(x) for x in d.split("-")] = [2018, 9, 25]
# datetime.datetime takes arguments for year, month, day, hour, minute second
# *[...] unpacks the list into these arguments, it's a shortcut for saing
# parts = [int(x)...]
# datetime.datetime(parts[0], parts[1], parts[2], ...)
start_date = datetime.datetime(*[int(x) for x in d.split("-")])
# add 1 day to start_date
end_date = start_date + datetime.timedelta(days=1)
# construct the where clause from above
# {0}, {1}, and {2} are placeholders that are filled with the format method
# the numbers are the indices of the method's arguments
where_clause = "{0} >= date '{1}' AND {0} < date '{2}'".format(
date_field,
start_date.strftime("%Y-%m-%d"),
end_date.strftime("%Y-%m-%d"))
... View more
09-23-2021
02:25 AM
|
1
|
0
|
5500
|
|
POST
|
Probably Python. In ArcGIS Pro, open the Python window: Edit and run this code: # characteristics of the attribute rule
rule_name = "LocationID"
rule_type = "CALCULATION"
triggers = "INSERT;UPDATE"
field = "LocationID"
is_editable = True
exclude = True
description = "Checks whether the feature is in a Forest or City area and inputs the corresponding value."
arcade_expression = """// Calculation Attribute Rule
// Field: LocationID
// Triggers: Insert, Update
// Exclude: True
// load the Areas poylgon class
var areas = FeatureSetByName($datastore, "NameOfFeatureclass", ["NameField"], true)
// intersect the areas with the inserted/edited feature
var inter = Intersects(areas, $feature)
// if feature is not in any area, return null
if(inter == null || Count(inter) == 0) {
return null
}
// else return the first intersecting area's name field
return First(inter).NameField"""
# list of your layer names / feature class paths, must be connected as data owner to have the permission to add rules
layer_list = [
"layer_1",
"database.sde/featureclass_2",
"layer_3",
]
for layer in layer_list:
print(layer)
try:
arcpy.management.AddAttributeRule(
in_table=layer,
name=rule_name,
type=rule_type,
triggering_events=triggers,
field=field,
is_editable=is_editable,
script_expression=arcade_expression,
exclude_from_client_evaluation=exclude,
description=self.description
)
print("success")
except Exception as e:
print("ERROR: {}".format(e))
... View more
09-23-2021
01:17 AM
|
0
|
2
|
4053
|
|
POST
|
Sure, doing it manually is very feasible, here. Either with a query or with Select By Attribute.
... View more
09-22-2021
06:24 AM
|
0
|
0
|
4446
|
|
POST
|
var fs1 = FeatureSetByName(...)
var fs2 = FeatureSetByName(...)
for(var row1 in fs1) {
var id1 = row1.FFGId
var filtered_fs2 = Filter(fs2, "FFGId = @id1")
for(var row2 in filtered_fs2) {
// do stuff
}
}
... View more
09-22-2021
06:20 AM
|
3
|
0
|
2124
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-30-2023 09:57 AM | |
| 1 | 05-18-2023 12:51 AM | |
| 1 | 03-05-2023 12:46 PM | |
| 1 | 12-07-2022 07:01 AM | |
| 1 | 06-21-2022 08:27 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-03-2024
06:14 PM
|