5
votes
Finding best path through set of many points using ArcGIS Pro
You can use Python with pandas and networkx modules:
import pandas as pd
import networkx as nx
import math
#Create a pandas dataframe using da.SearchCursor
layer = "points_to_visit" #The ...
- 60.5k
5
votes
Having trouble adding a layer from a Geodatabase using ArcPy
This code won't work in PyCharm. The "CURRENT" (currently open) project is only applicable when run from within ArcGIS Pro. When running outside of ArcGIS Pro such as from PyCharm, there is ...
- 58.2k
4
votes
Retrieving methods and attributes for "arcpy.Describe" function using "dir" - but returning empty list
You can use arcpy.da.Describe(), however, this will return a dictionary so the dir function will give you the methods and properties for a dictionary only. But you can easily access the property names ...
- 1,348
3
votes
Accepted
Changing value of layer attribute based on geometrical conditions of line elements through ArcPy in ArcGIS Pro
You can use pandas and arcpy together
#Create a pandas dataframe from your line layer with the columns ID and the line geometry
import pandas as pd
layer = 'lines_starting_ending_same'
fields = ["...
- 60.5k
2
votes
Adding Chart Guide using ArcPy in ArcGIS Pro
It can be done via the CIM module. See the Cartographic Information Model.
You want to work down from CIMCharts.axes -> CIMChartAxis.guides -> CIMChartGuide
- 980
2
votes
Assign grid squares to polygons that most contain them
I would try the following workflow:
Union your grid with your country boundaries
Summarize your data, grouping by cell ID and county name and computing max area
Create a query layer joining on cell ...
- 41.1k
2
votes
Converting geopackage to feature class (shapefile or geodatabase) using ArcGIS Pro
You can also use to Copy Features function.
Just take the gpkg file as Input and save the output to a gdb.
- 57
2
votes
Accepted
ArcGIS Pro Map Series Page Query Multiple/Different Criteria
Since you tagged this with arcpy, I'll offer up some options there that I've used to combine a definition query with a map series. Similar to your approach, I created an index layer with the ...
- 2,111
2
votes
Accepted
Projecting fishnet grid using ArcGIS Pro
By default, the fishnet calculation will be done using the the same projection as the inputs you've provided, in other words Web Mercator, which is inappropriate for really any geoprocessing. In this ...
- 335
2
votes
Accepted
Polygon Trace in Layout
What you are asking to do, tracing along an existing geometry is not a capability of a graphic, which are nothing more than "dumb shapes" drawn onto a map or a layout. Tracing along an ...
- 41.1k
2
votes
Adding two or more fields based on condition and reclass sum in existing field using ArcPy with ArcGIS Pro
You don't need a code block for this, you can handle it with a single expression by using 6.13. Conditional expressions - Python 3 documentation
(0 if !D1! == -9999 else !D1!) + (0 if !D2! == -9999 ...
- 1,566
2
votes
Creating a series of buffers along a stream polygon at set intervals in ArcGIS Pro
Forget about rectangles, they are only possible if river is straight line.
Just split your lines at equal interval (Generate Points Along line and Split by points) and run Euclidean allocation:
...
- 22.2k
2
votes
Moving Point features to other Point features
arcpy.AddGeometryAttributes_management(Input_Features="correct_geometry", Geometry_Properties="POINT_X_Y_Z_M", Length_Unit="", Area_Unit="", Coordinate_System=&...
- 22.2k
1
vote
Python code migration
To migrate your code from ArcMap to ArcGIS Pro, you need to change all references from arcpy.mapping to arcpy.mp. This is covered in the documentation here.
Have a look at the code sample #2 for ...
- 980
1
vote
Accepted
Show final two digits in attribute using dynamic text in ArcGIS Pro
You can label with the Arcade expression
right($feature.name, 2):
right function
- 60.5k
1
vote
Update specific row based on string
Try this:
import arcpy
fc = r"C:\Users\username\AppData\Local\Temp\ArcGISProTemp10292\Untitled\Default.gdb\points1"
fields = ["COMMENTS","COUNTY","STATUS"]
...
- 60.5k
1
vote
Arcade expression that selects the nth element in a dynamic table attribute based on map series rows
If you are following the steps in Spatial map series and dynamic elements, then this lets a user add a picture and later access that. On the same page it explains how to use figure using the url (...
- 520
1
vote
Adding two or more fields based on condition and reclass sum in existing field using ArcPy with ArcGIS Pro
Even shorter without code block:
sum([v for v in [ !D1!, !D2!, !D3!, !D4!] if v <>-9999])
Yes "<>" instead of "!="
- 22.2k
1
vote
Adding two or more fields based on condition and reclass sum in existing field using ArcPy with ArcGIS Pro
Is there a better way to write this script? I could have up to 8 columns to sum?
You could use a "starred arg" to accept any number of fields fed into the function which you can then ...
- 4,643
1
vote
How to quickly know number of elements in a class after classify in ArcGIS Pro like ArcMap 10.7
There is a tool in ArcGISPro called Frequency that will return a table with the counts of unique values in an attribute table.
There is a tool called Get Count that will return the total number of ...
- 8,347
1
vote
Exporting voxel sections to raster in ArcGIS Pro
As commented by Esri staff member Andrew--Johnson at Export voxel layer sections:
Unfortunately we have not had a chance to work on this as getting
voxel layers on the web was the higher priority. ...
- 64.5k
1
vote
Determining locations that contain multiple raster attribute types within a set distance
This can be solved using the Focal Statistics tool, here is some ESA landcover data:
Run it through Focal Statistics, using the Variety type as shown below:
You get this:
Each pixel is recording ...
- 41.1k
1
vote
Weighted raster using focal statistics and NbrWeight, but instead of using my kernel file, ArcGIS Pro keeps just using the default weights
If you read the How Focal Statistics works page you'll see:
The following apply for the kernel file for a weight neighborhood:
...
For the mean and standard deviation statistics, a weight can be any
...
- 58.2k
1
vote
Calculate width in road line
I split kerb lines into 20m segments and run Generate Near table between itself, limiting number of neighbors to three:
After that I joined selected records (>0) to segments. Result makes sense:
- 22.2k
1
vote
ArcGIS Jupyter Notebooks - calling the attribute Id
This code goes over the entire database and looks for just FeatureClasses and Tables. Maybe try this:
import arcpy, os
psg = "<your_db>"
datatype = ["FeatureClass", "...
1
vote
Accepted
ArcPy: ERROR 000584: Implementation of this Tool's Validate is invalid. Failed to execute (LayerToKML)
This is a good example of why you need to be reading the help file for the tool, especially the parameter section. It clearly states that the data type of the first parameter is a Feature Layer.
In ...
- 41.1k
1
vote
Accepted
Clip Living Atlas layer
You are running into a limitation of the webmap. There are probably a couple of alternatives to address this.
Do the data processing offline
The gNATSGO database, from which the California soil ...
- 335
1
vote
ArcGIS Pro Map Series Page Query Multiple/Different Criteria
You can stitch the pdfs together within arcpy by creating a blank pdf and then appending pages to it as they are created. ESRI has some documentation on this as well, but here is a snippet from a ...
- 11
1
vote
Accepted
Merge Tool that adds source layer as a field in Attribute Table
This is not time consuming, you just need to read the help file! If you look at the last parameter of the merge tool you can tick on the source the data is coming from. This functionality has been ...
- 41.1k
1
vote
JoinFeature attribute_relationship syntax (arcpy)
I was using arcpy.JoinFeatures_gapro(), but I think the syntax for them is the same. The fix is annoyingly simple and it took me more digging than it should've taken. Just add a second set of [] like ...
- 11
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
arcgis-pro × 3228arcpy × 843
arcgis-desktop × 661
raster × 179
modelbuilder × 177
symbology × 154
arcgis-online × 122
field-calculator × 110
python × 101
coordinate-system × 100
spatial-analyst × 97
arcmap × 91
layouts × 79
layers × 66
python-parser × 61
polygon × 60
attribute-table × 60
labeling × 58
arcade × 55
raster-calculator × 54
attribute-joins × 52
fields-attributes × 48
export × 48
network-analyst × 48
python-script-tool × 48