|
POST
|
Yes, aprx is the variable name for the current ArcGISProject object in the line of code I posted. Once you have that project, you will need to identify the Map in the project you want. If you know it by name for everyone, that's best. Otherwise, you'd have to look at all the maps to find a layer with the feature class name you want. Once you find the layer (by name) in the map of the project, step 1 I described above is complete.
... View more
09-15-2021
10:30 AM
|
0
|
14
|
5549
|
|
POST
|
There's nothing that will do this automatically. You will have to build the model manually based on the geoprocessing tasks the script uses. If the script has some advanced logic, you may not be able to create a model capable of completely replicating the script. What is the need to have a model instead of a script?
... View more
09-14-2021
03:53 PM
|
2
|
1
|
3402
|
|
POST
|
You can get the "current" project that is open running the script. Guidelines for arcpy.mp—ArcGIS Pro | Documentation aprx = arcpy.mp.ArcGISProject('current')
... View more
09-14-2021
12:21 PM
|
1
|
16
|
5562
|
|
POST
|
I'm not sure about making a custom selection and validating it with a model, but here are the tools I would use for writing my Python script. Find the layer you want to work on using the mapping module (arcpy.mp) Validate there is a selection with the layer's getSelectionSet() method (throw Exception if exactly one record is not selected.) Start an arcpy Editor. Test without the Editor first in case it just works. I don't think you need it for calculate field. Add geometry attributes. Only the selected features will have values calculated in the added fields; all other features will have null values. If this is not what you want, maybe try Calculate Field with the shape field.
... View more
09-14-2021
07:51 AM
|
0
|
18
|
5578
|
|
POST
|
With arcpy, you can find the layer you want by looking at the data source, validate if a feature is selected, and run calculate field on the layer (so it only calculates the selected field). You may need to use the Editor class to start and stop an edit session. Alternatively, you could put that responsibility on the user to start an edit session. Catch and handle the error that arises when not in an edit session and display a helpful message in the geoprocessing results indicating to the user what they need to do.
... View more
09-14-2021
07:19 AM
|
0
|
20
|
5585
|
|
POST
|
That error means you're taking a Result object (output from a geoprocessing tool) and inputting it directly into something else without unpacking it. I can't say exactly where it's happening since we don't have the whole script but look on line 183. Something there is getting a result object when it should be getting something more specific (like a string path to a feature class).
... View more
09-09-2021
01:11 PM
|
1
|
1
|
6310
|
|
POST
|
Are you getting a particular error message? If so, please paste the entire traceback if you can. Is everything in FCs_forSubdivisionBoundary a line or polygon feature class? Also, try using SubdivisionFC as the out_feature_class for FeatureToPolygon() instead of SubBoundaryFC_Name (because no workspace is specified).
... View more
09-09-2021
12:09 PM
|
0
|
3
|
6313
|
|
POST
|
@Anonymous User has some good suggestions for error handling. I want to point out that the except like that will catch all exceptions but will only attempt to output specifically arcpy geoprocessing errors. A more well rounded solution would be a specific except and a general except for everything else. import arcpy
Project_GDB = 'input random gdb'
try:
SubBoundaryFC_Name = 'SubdivisionBoundary'
SubdivisionFC = os.path.join(Project_GDB, SubBoundaryFC_Name)
# As Brooks mentioned, should SubdivisionFC be FCs_forSubdivisionBoundary below?
SubBoundary = arcpy.management.FeatureToPolygon(FCs_forSubdivisionBoundary, SubBoundaryFC_Name)
arcpy.AddMessage('{} has been created.'.format(SubBoundary))
except arcpy.ExecuteError:
arcpy.AddError(arcpy.GetMessages(2))
except Exception as e:
arcpy.AddError(e) Error handling with Python—ArcGIS Pro | Documentation
... View more
09-09-2021
07:52 AM
|
2
|
0
|
6327
|
|
POST
|
Try this solution with ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(extract_path)
... View more
09-01-2021
12:45 PM
|
2
|
3
|
4090
|
|
POST
|
What email client are you using? I've seen Outlook attempt to remove what it thinks are extra line breaks, causing some content to appear as a single line.
... View more
09-01-2021
09:51 AM
|
0
|
0
|
1502
|
|
POST
|
Could you copy an existing .tbx from a shared/network location to the parent folder?
... View more
09-01-2021
09:48 AM
|
1
|
1
|
1574
|
|
POST
|
Use querySelectorAll() to get the checked inputs by name attribute with "input[name='status']:checked" Then you can loop over the elements to get the value. I updated my html so they all have the same name attribute for easy identifying. <div class="checkboxContainer">
<input type="checkbox" id="online" name="status">
<label for="online">Online</label> <br />
<input type="checkbox" id="poweredOff" name="status">
<label for="poweredOff">Powered Off</label> <br />
<input type="checkbox" id="linkDown" name="status">
<label for="linkDown">Link Down</label> <br />
<input type="checkbox" id="gemPacketLoss" name="status">
<label for="gemPacketLoss">GEM Packet Loss</label> <br />
<input type="checkbox" id="lowOpticalPower" name="status">
<label for="lowOpticalPower">Low Optical Power</label> <br />
</div> const checkboxes = document.querySelectorAll("input[name='status']:checked");
let values = [];
checkboxes.forEach((checkbox) => {
values.push(checkbox.value);
});
console.log(values); You'll need some kind of a submit button to know when the user has finished checking the options, which will be the event trigger for updating your queryExpression. Here's the source for the logic I referenced.
... View more
08-11-2021
01:41 PM
|
0
|
1
|
3802
|
|
POST
|
You're using the wrong syntax for a file geodatabase. SQL reference for query expressions used in ArcGIS—ArcGIS Pro | Documentation Try ID_where_Clause = "INSTALLATIONDATELOWERLIMIT >= date '1935-01-01' AND INSTALLATIONDATEUPPERLIMIT <= date '2035-01-01'" If that doesn't work, try adding the time component like ID_where_Clause = "INSTALLATIONDATELOWERLIMIT >= date '1935-01-01 00:00:00' AND INSTALLATIONDATEUPPERLIMIT <= date '2035-01-01 00:00:00'"
... View more
08-10-2021
01:27 PM
|
2
|
0
|
5222
|
|
POST
|
I should have asked where your data is because that will change the syntax a little. Re: Using where clause to query date ranges in Arc... - Esri Community For example, a file geodatabase where clause with date would be ID_where_Clause = "INSTALLATIONDATELOWERLIMIT >= date '1935-01-01' AND INSTALLATIONDATEUPPERLIMIT <= date '2035-01-01'"
... View more
08-10-2021
12:00 PM
|
0
|
2
|
5233
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 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 |