|
POST
|
I get an "Edit with IDLE (ArcGIS Pro)" context menu entry when I right click a python file. You can also open an ArcGIS Pro Python command prompt: Start - ArcGIS - Python Command Prompt and type "idle" https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/installing-python-for-arcgis-pro.htm#:~:text=Python%20IDLE%20can%20be%20launched%20from%20a%20conda%20environment%20by%20typing%20idle.
... View more
04-28-2021
10:27 PM
|
0
|
0
|
14418
|
|
POST
|
The error is "AttributeError: 'module' object has no attribute 'mp'" not "AttributeError: 'ArcGISProject' object has no attribute 'defaultGeodatabase'" arcpy is your module object and python is telling you it has no "mp" attribute. Which sounds to me (like Dan says) that you're probably running your script using ArcGIS Desktop Python 2.7 not ArcGIS Pro Python 3.
... View more
04-27-2021
10:24 PM
|
0
|
5
|
14444
|
|
POST
|
You can also rename them in catalog, just like you would in the table of contents.
... View more
04-25-2021
08:17 PM
|
0
|
0
|
2695
|
|
POST
|
The following might be what you're looking for Make Query Table (Data Management) Make Query Layer (Data Management)
... View more
04-24-2021
05:53 AM
|
2
|
3
|
4976
|
|
POST
|
You can't. A .lyrx is a layer file not a dataset. Layers store a reference to the dataset, plus symbology and various other properties.
... View more
04-22-2021
02:03 PM
|
0
|
0
|
2367
|
|
POST
|
Easiest is to right-click the Raster to Polygon (Conversion) tool and select "Batch"
... View more
04-19-2021
09:36 PM
|
5
|
0
|
5698
|
|
POST
|
Yes, like I said, you are returning in your first loop iteration. So your function never gets to subsequent iterations. Doesn't matter though, you don't need to loop in your makeStatesLayer function. from arcpy import env # outside function so it only gets called once
import arcpy
def makeStateLayer(folder, name):
query = "StateField = '{0}'".format(name)
#Create a feature layer containing all states
statesLayer = arcpy.MakeFeatureLayer_management("State", "States_Layer",query)[0]
return statesLayer import arcpy, makeStateLayer, Statesnames
from arcpy import env
pathway = "C/1.gdb"
env.workspace = pathway
States_names = Statesnames.Statesnames(pathway)
for name in States_names:
stateLayer = makeStateLayer.makeStateLayer(pathway, name)
..........................................
#here I will delete the layer to get a new one at the beginning of the loop
# next iteration of this loop, you will get a new layer with the next state name.
... View more
04-17-2021
01:32 AM
|
2
|
0
|
2003
|
|
POST
|
It's a bit hard to say much as you don't include enough detail (i.e. where you get the "States_names" lists from, you didn't include your function "def", or show where you get "pathway" from or what you do with it in the function). However, if I assume the "States_names" list is the same in the function as it is in the main script... then it will only ever return the first value because you return in the first iteration of the loop. Try something like: makeStateLayer.py def makeStateLayer(state_path, state_name):
query = "StateField = '{0}'".format(state_name)
#Create a feature layer containing one state
statesLayer = arcpy.MakeFeatureLayer_management(state_path, "States_Layer", query)[0]
return statesLayer main_script.py from makeStateLayer import makeStateLayer
for name in States_names:
stateLayer = makeStateLayer(pathway, name)
... View more
04-16-2021
11:54 PM
|
0
|
3
|
2049
|
|
IDEA
|
Sub/superscript works in legend (but not in TOC which is preferred in my opinion because TOC is for authoring, not visualising, though if there was ability to switch between showing tags and showing formatted text that'd be ok) Legend TOC and symbology using text formatting tags
... View more
04-07-2021
04:51 PM
|
0
|
0
|
12028
|
|
POST
|
Not altogether familiar with arcade, but it uses Javascript like syntax. So your statement should look something like: if (condition1) {
// block of code to be executed if condition1 is true
} else if (condition2) {
// block of code to be executed if condition1 is false and condition2 is true
} else {
// block of code to be executed if the condition1 is false and condition2 is false
} For your code, something like: if (billclass == 'D') {
eru = 0
} else if (['V','I','H'].indexOf(billclass) >= 0) {
eru = Round(parea/43560,2)
} else if (billclass == 'R') {
eru = Round(parea*(2000/7760)/2000,2)
} etc...
return eru; Note there's no "in" operator, so even if you got the if and else if syntax correct, you'll get a Syntax Error: Binary Operator not recognised in so I've used the indexOf function and I've changed your python-like tuples ('V','I','H') to JavaScript-like arrays ['V','I','H'] I recommend you look at the arcade reference.
... View more
04-02-2021
04:41 AM
|
1
|
1
|
6456
|
|
POST
|
@LorindaGilbert wrote: Not really, the remainder of the script is after a few more lines: Which is where the error is.
... View more
04-01-2021
04:12 PM
|
0
|
0
|
4249
|
|
POST
|
eru = (Round(pimparea/2000,2) return eru; Either remove the bracket before Round or add a closing bracket.
... View more
04-01-2021
03:32 PM
|
1
|
2
|
4253
|
|
POST
|
Another way: fc = r'path/to/featureclass'
dateformat = '%Y-%m-%d'
datefields = [d.name for d in arcpy.ListFields(fc, field_type='Date')]
recs = []
with arcpy.da.SearchCursor(fc, ['OID@', 'TheDate']) as rows:
for row in rows:
recs += [r if f not in datefields else r.strftime(dateformat) for r, f in zip(row, rows.fields)]
print(recs) Or as a iterator: def datecursor(fc, dateformat, *args, **kwargs):
datefields = [d.name for d in arcpy.ListFields(fc, field_type='Date')]
with arcpy.da.SearchCursor(fc, *args, **kwargs) as rows:
for row in rows:
yield [r if f not in datefields else r.strftime(dateformat) for r, f in zip(row, rows.fields)]
fc = r'path/to/featureclass'
dateformat = '%Y-%m-%d'
recs = [row for row in datecursor(fc, dateformat, ['OID@', 'TheDate'])]
... View more
03-26-2021
03:14 AM
|
0
|
0
|
3833
|
|
POST
|
I don't remember pasting anything in in that particular post. Just typed straight into the editor. But yes other posts I've pasted stuff with formatting. Posting from phone now, but will keep that in mind and see if that causes the issue next time I post from a PC.
... View more
03-26-2021
01:59 AM
|
0
|
0
|
1603
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-24-2022 03:08 PM | |
| 1 | 07-30-2025 03:00 PM | |
| 1 | 06-10-2025 08:06 PM | |
| 5 | 05-20-2025 07:56 PM | |
| 1 | 05-04-2025 10:34 PM |