POST
|
Heck, I guess I should look at python toolboxes again. I tried switching a big .tbx to a python toolbox a few years ago and it was such a headache I bailed. But when ESRI released the .atbx promising "better cross-release compatibility and persistence, improved performance and scalability, and less possibility of file corruption" I figured that was the format of the future and so migrated everything to that. I don't think I can use custom methods in a ToolValidator class for anything other than changing the behavior of the form. At least, adding a finalValidation() method at the bottom and trying to reset a parameter value did nothing. For now, I will just use a dictionary in my script to catch the parameter form values and switch them to the same shorter values that would be used for a command line execution.
... View more
02-27-2025
01:10 PM
|
0
|
0
|
590
|
POST
|
Thanks, yes, I use main functions. But again, if the script is called by command line or another script and arguments are supplied positionally, the number of arguments and their indices will be different then when received from the parameter form and I won't know how to parse them.
... View more
02-27-2025
11:35 AM
|
0
|
2
|
592
|
POST
|
... but DON'T change the displayed value in the parameter control. For example, if a dropdown list of choices for a string parameter shows some long text, how can I send the script some shortened text or even a code for a particular choice without altering self.parameter[i].value; because when you re-set .value, the displayed value in the form changes and user sees the code instead of the more descriptive text. Another way to ask this question is, say I use a dictionary in my script to assign a short value or code to a variable based on some long text that is coming from a parameter in the form; can I move that step to the validation? One option would be to write the code value for a longer string to a hidden parameter, but then the tool still sends a redundant argument and if I want to make the script usable independent of a parameter form, I have to do some extra evaluation of the arguments. Can I intercept the list of arguments just after validation, but before the script is executed?
... View more
02-25-2025
01:29 PM
|
0
|
6
|
678
|
POST
|
Thanks. I think this is the answer: that it can't be controlled. That's too bad, but I can live with it.
... View more
02-13-2025
10:57 AM
|
0
|
0
|
627
|
POST
|
In the validation class for a script tool, I want to set the list for a multi-value string parameter by explicitly creating the order of items in a list. For example: self.params["objects"].filter.list = ["bananas", "strawberries", "limes", "apples"] But the values get sorted alphabetically: Can I stop the parameter from sorting the values?
... View more
02-12-2025
05:44 PM
|
0
|
5
|
688
|
POST
|
When in edit mode for an item's metadata, on the Geoprocessing History tab (I'm using Pro 3.4), there is an option for whether or not to include the history "in the official lineage for the item when its metadata is exported from ArcGIS to a standard-compliant XML format". I have checked this on for some steps and exported the metadata to both FGDC and ISO and in neither case is the geoprocessing history included. I don't know if it's a bug or I am misunderstanding something. Also, does anyone know what the arcpy method is for controlling this behavior? If there is one?
... View more
01-29-2025
09:49 AM
|
0
|
0
|
2555
|
POST
|
I am using the Story Builder to make a Map Tour StoryMap. I am starting with a point feature service where a point location may have multiple attached photos. Those attached photos are showing up as expected in the map tour, but I would like to add a caption or information somewhere for each one. When I make a map tour by starting from scratch, dragging in photos and selecting locations instead of using a feature service, for each photo that I add, there is an "Image options" icon where I can add credit attribution and alternative text, But for my attached photos there appears to only be a way to show attribution and alternative text based on content in a field in the feature service, which would apply to one feature, not each individual photo. Even if attribution text could be saved for each attached photo, the character limit is 125 and I have some captions that are longer than that. Is there another capability of the new StoryMaps that I could use for individual captions or other suggestions, short of annotating each image with a caption?
... View more
07-02-2024
06:16 PM
|
0
|
0
|
619
|
POST
|
Ok, that makes sense. Thanks. I have only ever used the 'Copy Python Command' for pasting into a larger script. The other option came up in a support question at work and I was confused.
... View more
07-02-2024
05:01 PM
|
0
|
0
|
731
|
POST
|
After you run a geoprocessing tool, you can go to the History view, right-click on the entry for the tool you ran, and select 'Save as python script'. For example, I saved this as a standalone file: import arcpy arcpy.ImportToolbox(r"@\Data Management Tools.tbx") arcpy.management.CalculateField( in_table="DataSources", field="deleteme", expression="3", expression_type="PYTHON3", code_block="", field_type="TEXT", enforce_domains="NO_ENFORCE_DOMAINS" ) My question is why is the second line there? When run against the arcgispro-py3 python interpreter, arcpy will be available, thus, so will arcpy.management.CalculateField making ImportToolbox redundant (the help page implies it's just for importing custom toolboxes). Not to mention that the path "@\Data Management Tools.tbx" throws an error when the script is run: OSError: The toolbox file @\Data Management Tools.tbx was not found. So, why does 'Save as python script' save a file like that?
... View more
05-21-2024
03:21 PM
|
0
|
2
|
911
|
POST
|
Just confirming that removing XTools Pro (installed by default with all instances of AGP in my agency) resolved the problem for me. Is there a bug number so we can track this?
... View more
05-10-2023
09:21 AM
|
3
|
1
|
3150
|
POST
|
Ah, this is a better solution than mine. My search-fu failed me when I was looking for such a tool.
... View more
04-10-2023
10:07 AM
|
0
|
1
|
2802
|
POST
|
I think you need to do this with python. I asked ChatGPT: import arcpy
# Set the input feature class
input_fc = r"path\to\your\feature\class"
# Create an arcpy.da.UpdateCursor to iterate through each row in the feature class
with arcpy.da.UpdateCursor(input_fc, ["SHAPE@"]) as cursor:
for row in cursor:
# Get the geometry of the current row
line = row[0]
# Create an empty array to hold the updated vertex coordinates
new_vertices = arcpy.Array()
# Iterate through each part of the line
for part in line:
# Create an empty array to hold the updated part vertices
new_part = arcpy.Array()
# Iterate through each vertex in the part
for vertex in part:
# Get the z-value of the current vertex in meters
z_meters = vertex.Z
# Convert the z-value to feet
z_feet = z_meters * 3.28084
# Create a new Point object with the updated z-value in feet
new_vertex = arcpy.Point(vertex.X, vertex.Y, z_feet)
# Append the new vertex to the updated part
new_part.append(new_vertex)
# Append the updated part to the array of updated vertices
new_vertices.append(new_part)
# Create a new Polyline object with the updated vertex array
# For the record, ChatGPT forgot to add the has_z argument below. It's not perfect!
new_line = arcpy.Polyline(new_vertices, has_z=True)
# Update the geometry of the current row with the new geometry
row[0] = new_line
# Update the cursor to save the changes to the current row
cursor.updateRow(row) I did a quick test and it worked for me. I ran it from a Notebook in my Pro project
... View more
04-06-2023
02:49 PM
|
0
|
1
|
2830
|
POST
|
Sorry, not quite. I am not trying to track down the objectid of an offending feature (that would be DestID), but the DestClassID of the line feature class that should be covering the boundaries of polygons in OriginClassID. And it's important because a polygon feature class can have that rule listed more than once in a Topology where for each occurrence a different line feature class is specified. If I want to inspect Line Errors and see if the rule has been violated for just one feature class, I need to see DestClassIDs listed. The Error Inspector knows what the DestClassID because it shows the appropriate line feature class in column Feature 2. Why isn't that information listed in Line Errors?
... View more
04-06-2023
02:09 PM
|
1
|
1
|
891
|
POST
|
I have a topology where one rule is polygon boundaries in MapUnitPolys must be covered by lines in ContactsAndFaults. When viewing the Error Inspector dialog to look at violations to this rule, both feature classes that participate in this rule are shown: But when I view the same information in the 'Line Errors' table, only the OriginClassID of the origin feature class is shown: Here, TopoRuleID 37 is the id for the 'Boundary Must Be Covered By' rule and OriginClassID 4 is my MapUnitPolys feature class. On row 2, I would expect the DestClassID of ContactsAndFaults, 47, to be shown, but what's there is 0. Is this the expected behavior? I am trying to script the reading of the various topology tables, but if they are incomplete, I'll need to do something else. ArcGIS Pro 3.0.3
... View more
03-28-2023
05:11 PM
|
0
|
3
|
961
|
Title | Kudos | Posted |
---|---|---|
1 | 10-25-2021 01:17 PM | |
3 | 05-10-2023 09:21 AM | |
1 | 04-06-2023 02:09 PM | |
1 | 07-07-2022 03:28 PM | |
2 | 07-07-2022 03:17 PM |
Online Status |
Offline
|
Date Last Visited |
03-26-2025
11:00 AM
|