|
POST
|
Trying to delete feature classes by name if they exist.
... View more
10-25-2022
09:26 AM
|
0
|
0
|
1360
|
|
POST
|
That is what I figured. So if I had to do this in model builder how would I go about it? I've tried creating a model using a "If data Exists" and Iterate Feature class but was unsuccessful.
... View more
10-25-2022
09:26 AM
|
0
|
0
|
1360
|
|
POST
|
I have a SDE feature data set with certain feature class I need to delete. I need to be able to delete them by name, because there are other feature class in there that I do not need to delete. I have the following, it runs but it doesn't delete anything. I get no error either. I am using this in a Calculate Value model. Expression FEMA1() Code block import arcpy, os
def FEMA1():
arcpy.env.workspace = r"C:/Users/***/AppData/Roaming/Esri/ArcGISPro/Favorites/***.sde/CCDS.CCDS.TempLyrs"
cws = arcpy.env.workspace
fc_Delete = ["CCDS.CCDS.FEMA_FLOOD_ZONES_Temp","CCDS.CCDS.FLOODWAY_Temp","CCDS.CCDS.LOMAs_Temp","CCDS.CCDS.LOMRs_Temp","CCDS.CCDS.FEMA_Cross_Sections_Temp","CCDS.CCDS.FEMA_Base_Flood_Elevations_Temp", "CCDS.CCDS.FEMA_PANELS_Temp"]
for fc in fc_Delete:
fc_path = os.path.join(cws, fc)
if arcpy.Exists(fc_path):
arcpy.Delete_management(fc_path)
else:
return ("Feature classes do not exist")
... View more
10-21-2022
10:30 AM
|
0
|
8
|
1444
|
|
POST
|
I made some changes to my arcade expressions and was able to get to work like I wanted to with the color but the issue I am having now is that if the "days" are "0", what I have as return"IN PROGRESS" doesn't work/popup. how can I get to return ""IN PROGRESS" if the there is zero days? Expression 1 var startDate = Date($feature["Received_date"]) var endDate = Date($feature["PI_DecisionDate1"]) var age = DateDiff(endDate, startDate, 'days'); // return "Response time:" + " " + age + "days"; if (age >= 0){ return "Response time:" + " " + age + "days"; } else if (age <= 0){ return "IN PROGRESS"; } Expression 2 var days = Round(DateDiff($feature["PI_DecisionDate1"], $feature["Received_date"], 'days'),0); var result = "" if (days <= 31){ //Less than result = "#0a75ad"; //Greater } else if (days >= 31){ result = "#fe015a"; } return result; HTML <p style="color:{expression/expr2};"><font size="4">{expression/expr1}</font></p>
... View more
09-13-2022
11:46 AM
|
0
|
0
|
1001
|
|
POST
|
All I have configured on my popup is {expression/expr1}. Not sure how to set it up, I've been looking for some video or blogs but I haven't' found one that explains how to configure the pop with the arcade expression. I was trying to originally wanted to display this in a Dashboard, to get an average of all, but couldn't figure out how so I thought I would try this on the map. I was able to get the popup to work with the following var startDate = Date($feature["Received_date"])
var endDate = Date($feature["PI_DecisionDate1"])
var age = DateDiff(endDate, startDate, 'days');
return "response time" + " " +age + " " + "Days"; But just a simple response time "10" days. With yours var startDate = Date($feature["Received_date"])
var endDate = Date($feature["PI_DecisionDate1"])
var age = DateDiff(endDate, startDate, 'days')
var age_str = Iif(
!IsEmpty(endDate),
`Response time: ${Text(age)} Days`,
'IN PROGRESS'
)
var age_color = When(
age <= 30, "#2986cc",
age > 30, "#d21c06",
"#f9905d"
)
return {
type : 'text',
text : `<font color=${age_color}>${age_str}`
} I get the following when I hit the Test button. Result Value Result text <font color=#2986cc>Response time: 22 Days type text Type Dictionary Map popup display. [object Object]
... View more
09-12-2022
12:38 PM
|
0
|
4
|
1025
|
|
POST
|
I been trying to start this basic Arcade expression, well I thought it was basic. I want to display the difference between two date fields and if the number of days are less then 30 display the number of days in blue, if the number of days are over 30 days display the number of days in red. if there is no date in the "PI_DecisionDate1" then return "In Progress". Here is what I have started, both fields are date fields // Write a script to return a value to show in the pop-up.
// For example, get the average of 4 fields:
// Average($feature.SalesQ1, $feature.SalesQ2, $feature.SalesQ3, $feature.SalesQ4)
var startDate = Date($feature["Received_date"])
var endDate = Date($feature["PI_DecisionDate1"])
var age = DateDiff(endDate, startDate, 'days');
return "response time" + " " +age + " " + "Days";
//Less than
IF(age <= 30){
return age + "#2986cc"
}
//Greater than
IF (age >= 31){
return age + "D21C06"
}
// else return
// else{
// return "IN PROGRESS" "F9905D"
//} result with the above, but I don't see the days populated when I click on the features on the map. Also, the formula doesn't see right from what I can tell. Result Value Result response time 43 Days Type String
... View more
09-12-2022
11:04 AM
|
0
|
6
|
1057
|
|
POST
|
I have looked into it, but this snip-it of code will be part of a larger code and it would be nice to not have to create new files then have to join them back.
... View more
08-16-2022
07:32 AM
|
0
|
1
|
1052
|
|
POST
|
I have a feature class that I need to compare two of each feature and the two fields have the same info, I want to delete them. I have some code that works for the table but I know that working with spatial data I may get inconsistent results. I made the following but I am uncertain I am dong it correctly, and I don't get any errors. import arcpy
fc = r'C:\Temp\test.shp'
fields = ['OID@', 'PN', 'ACT', 'ACRES']
# if need just two field use ['OID@','PN', 'ACT']
sort_field, sort_order = "OBJECTID", "ASC"
fields = fields
sql_orderby = "ORDER BY {}, {} {}".format(", ".join(fields), sort_field, sort_order)
table_rows = []
with arcpy.da.UpdateCursor(fc, fields, sql_clause=(None, sql_orderby)) as cursor:
for row in cursor:
if row[1:] in table_rows:
cursor.deleteRow()
else:
pass
table_rows.append(row[1:])
del table_rows I would also like to see if I can use the same code to update a field "Duplicate" with the text "Dup", if they are duplicates, so I can double check that the correct features are being deleted on a copy of the feature class.
... View more
08-15-2022
01:30 PM
|
0
|
3
|
1102
|
|
POST
|
When you say that I don't have a column with a unique Value, doesn't the OBJECTID in the feature class and table count as unique columns?
... View more
03-04-2022
11:34 AM
|
0
|
0
|
745
|
|
POST
|
My apologies, I might have complicated things. I removed fields to make the files smaller. I hope this makes sense and thank you so much for trying to help. The feature class and the table only have the PermitNum field as unique identifiers. I adding fields to the feature class to match the tables fields. So I can transfer attributes from the table to the feature class.The table can have multiple permits with more than one parcel associated with that permit. For example in the table PermitNum Parcle CR2020-0005 34252 CR2020-0005 34263010 CR2020-0005 34263012 : The feature class only has the following the PermitNum. PermitNum Parcel CR2020-0005 CR2020-0005 CR2020-0005 And when I run the code on my first post I get the following PermitNum Parcel CR2020-0005 34263010 CR2020-0005 34263010 CR2020-0005 34263010 I need to transfer the table attributes to the feature class like below. Feature class after the code PermitNum Parcle CR2020-0005 34252 CR2020-0005 34263010 CR2020-0005 34263012
... View more
02-25-2022
12:59 PM
|
0
|
2
|
764
|
|
POST
|
I used the following. took me a while to figure out that ")" went after the $feature.percentage. IIF(Text($feature.percentage) == '25', 'background-color:#1987bb', 'background-color:#DDDDDD')
... View more
02-18-2022
03:41 PM
|
0
|
0
|
1875
|
|
POST
|
I was able to accomplish this with the following but it only works for "Text" fields. My fields is a Long field. How can change the Arcade code to accept the long field? Arcade IIF($feature.PercentCom == '25', 'background-color:#1987bb', 'background-color:#DDDDDD') HTML <span><b><br /><br /><br />Phase</b></span>
<table style=" border-collapse: separate; border-spacing: 6px 4px; width: 100%; table-layout: fixed;">
<tbody><tr height="16">
<td style="{expression/expr0}"></td>
<td style="{expression/expr1}"></td>
<td style="{expression/expr2}"></td>
<td style="{expression/expr3}"></td>
</tr>
<tr height="24" style="text-align: center;">
<td>25%</td>
<td>50%</td>
<td>75%</td>
<td>100%</td>
</tr>
</tbody></table>
... View more
02-18-2022
01:57 PM
|
0
|
2
|
1881
|
|
POST
|
I am trying to add a progress bar to an ArcGIS online map, pretty much like the example from MikeSchoelen. https://community.esri.com/t5/arcgis-dashboards-blog/adding-a-progress-bar-to-an-indicator-with-a/ba-p/1133559 I have tried configuring the Custom Attribute Display in the maps Configure pop-up but I have been unsuccessful. I would appreciate any info on how to do this. I've been trying to do this in HTML but Arcade would be ok as well. <h1>The progress element</h1> <label for="file">Downloading progress:</label> <progress id="file" max="100" value="32"> 32% </progress>
... View more
02-18-2022
10:04 AM
|
0
|
3
|
1929
|
|
POST
|
Jeffk, thank you very much for the help and my apologies for the corrupt data. I have attached new data and have verified that it should work. I have changed the TablesView field name from 'Par' to 'Parcel_1' and the feature classes field name'Par' to 'Parcel' as it was getting confusing. I have the following based on you provided but the 'Parcel' field is being populated in the Case_lyr feature class. The valueDict prints- 'CR2021-0006R2957001100': 1, 'OR2021-0008R3014800000' The concatenatedKey - prints CR2022-0001R3301700000 CR2022-0001R3301901000 sourceFC = "C:/Temp/Cases.gdb/Table_View"
valueDict = {}
with arcpy.da.SearchCursor(sourceFC, ['OBJECTID', 'PermitNum','Parcel_1']) as sCur:
for row in sCur:
# str(row[sCur.fields.index('AppS')]).replace('/', '') <- use this to convert the dates in the App fields to strings
concatenatedKey = row[sCur.fields.index('PermitNum')] + str(row[sCur.fields.index('Parcel_1')])
if concatenatedKey in valueDict.keys():
print(f'duplicate concatenation: {concatenatedKey}')
else:
valueDict[concatenatedKey] = row[sCur.fields.index('OBJECTID')]
fc_dest = "C:/Temp/Cases.gdb/Cases_lyr"
with arcpy.da.UpdateCursor(fc_dest, ['OBJECTID', 'PermitNum','Parcel']) as uCur:
for row in uCur:
if row[2] is None:
lookupKey = row[sCur.fields.index('PermitNum')] + str(row[sCur.fields.index('Parcel')])
if lookupKey in valueDict.keys():
print(f'{lookupKey} found, setting Par to: {valueDict.get(lookupKey)}')
uCur.updateRow(row)
... View more
02-18-2022
09:13 AM
|
0
|
5
|
1433
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-27-2022 11:37 AM | |
| 1 | 10-31-2023 10:16 AM | |
| 1 | 02-16-2023 01:50 PM | |
| 1 | 08-11-2021 11:13 AM | |
| 1 | 01-06-2021 10:45 AM |
| Online Status |
Offline
|
| Date Last Visited |
09-10-2024
10:42 AM
|