|
POST
|
Does arcpy.ListFiles() return the file list you expect? Have you inspected the returned list to make sure it's not empty? Have you tried setting a wildcard filter, e.g. arcpy.ListFiles('*.txt')?
... View more
03-12-2021
03:24 AM
|
1
|
0
|
4245
|
|
POST
|
Please can you post code, not screenshots of code. https://community.esri.com/t5/python-blog/code-formatting-the-community-version/ba-p/1007633
... View more
01-31-2021
02:42 PM
|
0
|
1
|
6652
|
|
POST
|
You can create (and publish to AGOL) a group layer. Group layers can contain multiple layers of the same type or different types. Terminology note - "feature layer" generally means an object that links to the actual data and can contain symbology, definition queries, attribute joins to other data among other things. A "feature class" is the data itself.
... View more
12-22-2020
03:17 PM
|
3
|
0
|
13652
|
|
POST
|
ETRS89 / UTM zone 33N is a projected coordinate system and uses metres as the horizontal units. If you want decimal degrees, you need to use a geographic coordinate system (like you did with WGS84). Have you tried selecting the ETRS89 geographic coordinate system?
... View more
10-30-2020
11:08 PM
|
0
|
0
|
1455
|
|
POST
|
arcpy.sa.ZonalStatistics outputs a raster not a table. You need arcpy.sa.ZonalStatisticsAsTable
... View more
07-31-2020
02:47 PM
|
0
|
0
|
2509
|
|
POST
|
You're using the same point for the start and end of the line, i.e. geom1 == geom2 because you haven't updated the row. This is probably why you get a zero length line. Try: for row in cur:
geom1 = row[0].getPart()
next_row = cur.next()
geom2 = next_row[0].getPart()
... View more
07-27-2020
09:51 PM
|
2
|
1
|
4364
|
|
POST
|
Updating user environments on upgrade of Pro...? It's going to have potential for lots of issues - package versions, 3rd party channels. I treat conda envs as disposable, to be spun up and disposed of as required. It's a lot easier to build a fresh env than fix or update one. What would really be useful is an updated conda.
... View more
07-22-2020
09:24 PM
|
2
|
1
|
2488
|
|
POST
|
Something simple like the following perhaps? So you don't completely hide the actual error as well. except requests.exceptions.RequestException as err:
print(err, url)
... View more
06-08-2020
12:27 PM
|
1
|
0
|
3731
|
|
POST
|
You haven't got your requests.get call inside the try block, you have unrelated code in there, the soup.find stuff.
... View more
06-05-2020
08:47 PM
|
1
|
1
|
9184
|
|
POST
|
Multipart polygons cannot share borders. From the help: Keep in mind that parts in a multipart polygon are spatially separated. They can touch each other at vertices, but they cannot share edges or overlap.
... View more
06-05-2020
08:33 PM
|
1
|
0
|
3090
|
|
POST
|
You might get some help if you posted in a general programming forum like Stack Overflow. This site is for Esri / ArcGIS software, not general python.
... View more
06-02-2020
05:37 AM
|
0
|
0
|
1790
|
|
BLOG
|
DOCELL returns! You can mark this idea done Add DOCELL to Spatial Analyst
... View more
02-22-2020
05:28 PM
|
1
|
0
|
1022
|
|
POST
|
It's a string expression and is evaluated outside the scope of your current code so has no knowledge about any of your variables. You need to insert the actual value into the string: class YourTool(object):
def __init__(self):
etc...
def getParameterInfo(self):
etc...
def execute(self, parameters, messages):
"""The source code of the tool."""
inputdataset = parameters[0].valueAsText # getting the parameters
count_rows = arcpy.GetCount_management(inputdataset)
total_rows = int(count_rows.getOutput(0))
expression = '''
def getCitation(p_dataset_id):
total_rows = {}
if(total_rows == 5):
ds=PanDataSet(p_dataset_id)
return ds.citation
'''.format(total_rows)
Note - you can't indent the expression, or it won't be valid python syntax when the tool evaluates it - IndentationError: unexpected indent. If you want your code to look cleaner and have the expression indented, you can use inspect.cleandoc(expression) inspect — Python 2.7 documentation inspect — Python 3.8 documentation inspect. cleandoc (doc) Clean up indentation from docstrings that are indented to line up with blocks of code. All leading whitespace is removed from the first line. Any leading whitespace that can be uniformly removed from the second line onwards is removed. Empty lines at the beginning and end are subsequently removed. Also, all tabs are expanded to spaces. import inspect
class YourTool(object):
def __init__(self):
etc...
def getParameterInfo(self):
etc...
def execute(self, parameters, messages):
"""The source code of the tool."""
inputdataset = parameters[0].valueAsText # getting the parameters
count_rows = arcpy.GetCount_management(inputdataset)
total_rows = int(count_rows.getOutput(0))
expression = inspect.cleandoc('''
def getCitation(p_dataset_id):
total_rows = {}
if(total_rows == 5):
ds=PanDataSet(p_dataset_id)
return ds.citation
'''.format(total_rows))
... View more
01-26-2020
07:01 PM
|
0
|
0
|
3363
|
|
POST
|
For max and min, you can use the HighestPosition and LowestPosition tools. These return the position of the raster with the maximum/minimum value in a list of rasters.
... View more
01-22-2020
12:59 PM
|
2
|
0
|
882
|
|
POST
|
I've never used ApplySymbologyFromLayer in a toolbox so can't comment on the issue, but what I do that works is set the symbology property of output layer parameters, and the symbology is automagically applied when the output parameter is set at the end of my execute method: class Tool(object):
def getParameterInfo(self):
params = []
params[0] = arcpy.Parameter(
displayName="Output Raster Layer",
name="out_raster_lyr",
datatype="GPRasterLayer",
parameterType="Derived",
direction="Output")
params[0].symbology = r'path\to\symbology.lyrx'
return params
def execute(self, parameters, messages):
layer = do_something_and_return_a_layer()
arcpy.SetParameter(0, layer) # Layer gets added to the map with symbology applied without me manually applying it.
... View more
01-19-2020
04:07 PM
|
0
|
0
|
910
|
| 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 |