POST
|
Probably either Folder or Workspace (or even String) would work for the parameter type for "out_folder", but you'll want to change the direction to "Input". Even though you'll be writing files to that folder, it's still an input parameter. Also, just in the interest of more elegant coding, you should move the statement "dest_path = arcpy.GetParameterAsText(1)" up to the top and out of the loop - it only needs to be executed once.
... View more
07-07-2023
01:40 PM
|
1
|
0
|
920
|
POST
|
It would help get responses if you could format your code to make it more readable: https://community.esri.com/t5/community-help-documents/how-to-insert-code-in-your-post/ta-p/914552
... View more
07-07-2023
11:57 AM
|
0
|
1
|
933
|
POST
|
Looks like you've created your outFC as POLYLINE (line 71), but you want to write point geometries to it?
... View more
07-05-2023
03:13 PM
|
0
|
0
|
380
|
POST
|
In your scursor loop you've got "row" as the index, but then you're redefining "row" at the bottom of the scursor loop. I think you want to assign a different variable there - something like: "row_pt = ( row[0], pt_geometry, row[2], row[3])" icursor.insertRow(row_pt) Also, it looks like your row insertion is attempting to assign an OID to the inserted record - it seems to me that since the OID is assigned by Arc you may not be able to do that, though I may be wrong on that.
... View more
07-05-2023
01:33 PM
|
0
|
2
|
405
|
POST
|
If the first three checks of your if/elif statements are not satisfied, your else statement will set Program = 'Public' for any ptype, not just the ptype you're currently trying to check - I don't think that's what you want, right? You'd need to enclose the whole if statement structure in an outer "if row[0] == ptype:" (or replace the final else with "elif row[0] == ptype:").
... View more
06-07-2023
04:07 PM
|
1
|
1
|
610
|
POST
|
It will be easier for folks to address your question if you format your code. Please see these guidelines - https://community.esri.com/t5/community-help-documents/how-to-insert-code-in-your-post/ta-p/914552
... View more
05-18-2023
11:02 AM
|
1
|
1
|
472
|
POST
|
Seems like maybe a projection problem? The place where they're plotted is right about the origin (0,0) of the default ESRI coordinate system (WGS 1984 Web Mercator), so it looks like your layer thinks the points are around (31, 30) meters rather than degrees?
... View more
05-17-2023
07:10 AM
|
0
|
1
|
337
|
POST
|
Looks like the resampling method you're looking for is maybe in the environment settings? https://pro.arcgis.com/en/pro-app/latest/tool-reference/environment-settings/resampling-method.htm
... View more
05-11-2023
08:25 AM
|
0
|
1
|
436
|
POST
|
I'm not sure if you're talking about an automated way to do this, but for a quick solution, I usually just right-click the layer / Data Design / Fields. Then click the upper left of that table (with the small triangle) to select everything, then right-click again to copy, then just paste it into Excel. You'll have to add your own "field index" - I don't know of any view in ArcGIS that gives a field "index" In a python window you could do something this: i=0
for f in arcpy.ListFields(feature_class):
print(str(i) + " " + f.name)
i+=1
... View more
04-20-2023
03:26 PM
|
0
|
0
|
293
|
POST
|
Sorry, I didn't phrase that correctly - I meant the loop index, not list index - if you are using the 8-day MODIS, then you'd need to replace the last line with "i+=8" instead of "i+=1"
... View more
03-06-2023
07:19 AM
|
0
|
0
|
857
|
POST
|
Can't you just build the list in python rather than using arcpy.ListRasters()? I.e., if your rasters were named as you suggested above, it would go something like this: lstRasters = []
i = 1
while i < 90:
if i < 10:
rnum = "00" + str(i)
else:
rnum = "0" + str(i)
lstRasters.append(os.path.join(Terra_D, "A2021" + rnum))
i+=1 Then use lstRasters in CellStatistics. If you're working with 8-day MODIS averages rather than daily, then of course you'd modify the list index. Unless I'm not understanding your question...
... View more
02-27-2023
03:41 PM
|
1
|
1
|
1035
|
POST
|
Thanks much for confirming. One other thing I forgot to mention - if you type in a valid field name - i.e., one that exists in the attribute table - the tool will accept it. Conversely, it will throw an error if you type in a field name that doesn't exist in the table.
... View more
02-02-2023
11:42 AM
|
0
|
0
|
332
|
POST
|
I am stumped on how to create an interface using either a Custom or a Python toolbox that will allow a user to input a list of raster layers and a selected field from each raster. It seems as though a value table is the way to go, but although this works for feature layers, it apparently does not work for raster layers. As illustrated in the following code snippet from a python toolbox and the resulting screenshot, you can have a parameter that takes a single raster layer and another that takes a field with a dependency between the two, and you get a picklist of raster attributes as expected (provided the raster has an attribute table). And, using a value table to input multiple feature classes, you also get the expected picklist of attributes for each feature class. But you do not get the picklist using a value table with raster layers, as shown in the screen shot. This value table functionality for feature layer/field pairs has apparently been around since Pro v 2.4 (according to this post by @DrewFlater -- https://community.esri.com/t5/python-questions/python-toolbox-value-table-with-list/m-p/546572/highlight/true#M42642) - is there a plan to extend this to rasters as well? (or am I just missing something here?) In the absence of having this functionality available using value tables, does anyone have ideas on how to accomplish this seemingly simple task -- i.e., a way for a user to enter a list of raster/field pairs? Any insights would be greatly appreciated - thank you! class Tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Value Table Test"
self.description = ""
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
# Param0 is raster layer
param0 = arcpy.Parameter(
displayName = "Raster #1",
name="Raster1",
datatype="Raster Layer",
parameterType="Optional",
direction="Input")
# Param1 is raster field
param1 = arcpy.Parameter(
displayName = "Raster #1 field",
name="Raster1_field",
datatype="Field",
parameterType="Optional",
direction="Input")
param1.parameterDependencies = [param0.name]
#param2 is a value table of feature layers & fields
param2 = arcpy.Parameter(
displayName = "Feature Layers",
name="Feature_list",
datatype="GPValueTable",
parameterType="Optional",
direction="Input")
param2.columns = [["GPFeatureLayer", "Feature Layer"], ["Field", "Field Name"]]
#param3 is a value table of raster layers and fields
param3 = arcpy.Parameter(
displayName = "Raster Layers",
name="Raster_list",
datatype="GPValueTable",
parameterType="Optional",
direction="Input")
param3.columns = [["GPRasterLayer", "Raster Layer"], ["Field", "Field Name"]]
params = [param0, param1, param2, param3]
return params
... View more
02-02-2023
09:30 AM
|
0
|
2
|
355
|
POST
|
You might get more responses if you format your code - it's very difficult to see what's going on as you've posted it. Here's some community guidelines for inserting code into a post: https://community.esri.com/t5/community-help-documents/how-to-insert-code-in-your-post/ta-p/914552 Also might want to include other details like how are you running this code (python window, PyCharm, Toolbox, etc). Also, the output of your print statements would be useful. If this is the entire code it seems you haven't imported os. Also, did you append "_ATTACH" to the end of your table name? It's hard to help unless you supply all the details...
... View more
01-24-2023
11:57 AM
|
0
|
0
|
906
|
POST
|
Thank you for your response. In the clone in which I installed spyder using just the package manager, I installed 5.1.5, and with that version, Arc installed spyder-kernels 2.1.3. In that case, code completion doesn't work in spyder, and Notebooks breaks. Using the fix suggested here, the code completion problem is fixed, but not the notebooks problem: https://community.esri.com/t5/python-questions/code-completion-not-working-in-spyder-5-1-5-after/m-p/1186076#M64825 Agreed, every new Arc version generates new python problems 😞
... View more
11-07-2022
02:00 PM
|
0
|
1
|
830
|
Title | Kudos | Posted |
---|---|---|
1 | 07-07-2023 01:40 PM | |
1 | 06-07-2023 04:07 PM | |
1 | 05-18-2023 11:02 AM | |
1 | 02-27-2023 03:41 PM | |
1 | 11-04-2022 04:30 PM |
Online Status |
Offline
|
Date Last Visited |
11-30-2023
03:49 PM
|