|
IDEA
|
Woo! Thanks @ShanaBritt. I see the MINIMAL_AND_USER option has been added to the Python documentation too.
... View more
04-26-2023
08:43 AM
|
0
|
0
|
2672
|
|
IDEA
|
I can't believe this doesn't exist. Please allow for creating new rows in a standalone table. Better yet, if you could replicate ability to edit feature relationships like ArcGIS Pro.
... View more
04-25-2023
03:33 PM
|
0
|
0
|
6389
|
|
POST
|
You'll want to switch to using the "memory" workspace in ArcGIS Pro rather than the "in_memory" from ArcMap. Write geoprocessing output to memory—ArcGIS Pro | Documentation
... View more
04-25-2023
11:38 AM
|
0
|
1
|
2734
|
|
POST
|
Is this a DMZ server? Maybe you need to open some firewall ports for the server to access that url. As for the other scripts just "stopping", do you have try/except blocks? What are you doing when you catch an Exception?
... View more
04-24-2023
10:28 AM
|
0
|
1
|
4143
|
|
POST
|
You could use ArcSDESQLExecute to query your data, format into a dictionary, then use an update cursor or calculate field to update the values by looking them up in your dictionary.
... View more
04-19-2023
10:55 AM
|
1
|
0
|
1681
|
|
POST
|
Yep. Calculate Field is what you want. For variety, here's the Python equivalent. !HASC_1!.replace("RO.", "")
... View more
04-13-2023
06:52 AM
|
0
|
0
|
1334
|
|
POST
|
I concur. I see you already have messaging to write the fields (line 67 of your code snippet). What is that output? Like @DonMorrison1 said, you'll need to turn it into a list field names (strings). SearchCursor—ArcGIS Pro | Documentation
... View more
04-10-2023
01:54 PM
|
0
|
0
|
1733
|
|
POST
|
Like this then? fields = ["OWN1", "OpCo", "RightsType", "Type_of_Use"]
with arcpy.da.UpdateCursor(fc, fields) as u_cursor:
for own1, opco, rightstype, type_of_use in u_cursor:
if own1 in ("ITC", "TRANSMISSION, TAX DEPARTMENT"):
opco = "ITCT"
elif own1 == "CONSUMERS":
opco = "METC"
u_cursor.updateRow([own1, opco, rightstype, type_of_use])
... View more
03-30-2023
10:48 AM
|
1
|
0
|
3956
|
|
POST
|
You're still not telling me what you are tying to do. I'm still guessing, but here's another method to consider. # Build dictionary of domain objects for each field.
domains = arcpy.da.ListDomains(gdb)
field_domain = {}
for field in arcpy.ListFields(fc):
dom = [d for d in domains if d.name == field.domain]
if dom:
field_domain[field.name] = dom[0]
# Update data to change code to description.
fields = ["OWN1", "OpCo", "RightsType", "Type_of_Use"]
with arcpy.da.UpdateCursor(fc, fields) as u_cursor:
for own1, opco, rightstype, type_of_use in u_cursor:
# Pick the right domain coded values
if own1 in ("ITC", "TRANSMISSION"):
coded_values = field_domain["OpCo"].codedValues
elif "INT " in own1 or "IT " in own1 or own1 == "TRANSMISSION, TAX DEPARTMENT":
coded_values = field_domain["RightsType"].codedValues
# elif a_field == some other condition:
# coded_values = field_domain["a_field"].codedValues
else:
raise Exception(f"This data doesn't match any criteria.\n{[own1, opco, rightstype, type_of_use]}")
# Change field value.
own1 = coded_values['ITCT']
# Update the row.
u_cursor.updateRow([own1, opco, rightstype, type_of_use])
... View more
03-29-2023
03:13 PM
|
1
|
2
|
3190
|
|
POST
|
@nsidaniel wrote: @BlakeTerhune, no need to apologize, I appreciate your help! For context, I posted the feature class' attribute table that the code produces below the python. So I assume your question is not answered? Could you describe exactly what you want to do?
... View more
03-28-2023
01:16 PM
|
1
|
4
|
3234
|
|
POST
|
I missed that about watchUtils going away! Looks like it's getting replaced by reactiveUtils. Looking forward to hearing from the Esri team on this. EDIT: I got reactiveUtils working with api v4.26 in the sample from @ReneRubalcava require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/core/reactiveUtils"
], function(EsriMap, MapView, FeatureLayer, reactiveUtils) {
const fLayer = new FeatureLayer({
portalItem: {
id: "848d61af726f40d890219042253bedd7"
}
});
const fLayer2 = new FeatureLayer({
url: "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/ACS_Population_by_Race_and_Hispanic_Origin_Boundaries/FeatureServer/2"
});
const map = new EsriMap({
basemap: "dark-gray-vector",
layers: [fLayer, fLayer2]
});
const view = new MapView({
container: "viewDiv",
map: map,
center: [-118, 34],
zoom: 9
});
const goTo = view.goTo.bind(view);
Promise.all([
view.whenLayerView(fLayer),
view.whenLayerView(fLayer2)
]).then(([layerView1, layerView2]) => {
return Promise.all(
[
reactiveUtils.whenOnce(() => !layerView1.updating),
reactiveUtils.whenOnce(() => !layerView2.updating)
]
);
}).then(() => {
console.log("done updating")
});
});
... View more
03-28-2023
11:29 AM
|
2
|
1
|
4217
|
|
POST
|
I'm either misunderstanding your question or your original intent. Your code is applying the same value to that field on every row. If you want it to apply a lookup value based on what's already in the field, then you probably want to change it like this. with arcpy.da.UpdateCursor(fc, fieldname) as cursor:
for row in cursor:
row[0] = lookup_values[row[0]]
cursor.updateRow(row) My apologies if I'm not answering the correct question.
... View more
03-28-2023
11:23 AM
|
1
|
0
|
3250
|
|
POST
|
That error means there's no key of "Fee" lookup_values dictionary when you build it for the RightsType field. Some things to check: Is a domain assigned to that RightsType field? If so, is the domain you expect? Does that domain have a description of "Fee"? Your zip is putting the description as the key in lookup_values and code in value. Also remember that this lookup value is case sensitive. Maybe print() lookup_values when you build it for the RightsType field so you can confirm what you're getting.
... View more
03-28-2023
10:03 AM
|
1
|
1
|
3272
|
|
POST
|
Your example code has a lot of syntax errors. If I'm interpreting it correctly, then something like this should work. import arcpy
import datetime
fields = ['date_diag','periodicity','maj_previsional']
expression = "date_diag <> '' and date_diag is not null"
with arcpy.da.UpdateCursor(inFeatures, fields, expression) as cursor:
for date_diag, periodicity, maj_previsional in cursor:
if date_diag:
maj_previsional = maj_previsional + datetime.timedelta(days = periodicity * 365)
cursor.updateRow([date_diag, periodicity, maj_previsional]) If you need to account for leap year/day, then you'll have to update the date calculation.
... View more
03-28-2023
08:16 AM
|
0
|
0
|
1983
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-23-2025 03:53 PM | |
| 1 | 04-28-2026 07:25 AM | |
| 1 | 03-19-2026 08:59 AM | |
| 1 | 02-12-2026 01:37 PM | |
| 1 | 12-01-2025 06:19 AM |