Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
A site-package created by Esri to expose ArcGIS Desktop (ArcMap and ArcGIS Pro) geoprocessing, mapping, etc, to Python.
1
vote
Accepted
trying to find max value in a field and define value as variable
You code seems pretty close:
max_value = -99999999
with arcpy.da.SearchCursor(centerline, "SAMPINS") as cursor:
for row in cursor:
max_value = max(int(row[0]), max_value)
# do something w …
3
votes
Accepted
arcpy.exists returns true, file not in gdb
This is the same problem as covered in Arcpy: MakeFeatureLayer_management: Where is the file? …
4
votes
arcpy.da.searchCursor - need to go through all records, but only go through one. What am I m...
You don't need to use selections in your search cursor, you can grab the geometry of each feature in FC1:
with arcpy.da.SearchCursor(fc1, ["SHAPE@", "MY_DEBUG_FIELD", "SOME_OTHER_FIELD") as searc …
4
votes
Accepted
Append a placeholder value to a list wherever a value is not present in a table
arcpy.Exists tells you if a dataset exists somewhere.
Starting with a dictionary of default values, you could update the dictionary where a value exists in your table, then create the output list in …
1
vote
Subsequent Python Script Processing Doesn't Adjust Zoom to Selected Features
I'm not sure why it works once, but I think the problem has something to do with that df.zoomToSelectedFeatures() zooms to features that are selected inside the dataframe.
But if NP_Allowances is als …
1
vote
Iterating a model that contains values too low
Based on your description are you looking for Get Count?
Returns the total number of rows for a table.
If the input is a layer or table view containing a selected set of records, only the select …
5
votes
row.getValue() doesn't work but row[1] does
If you want to do something like getValue() with arcpy.da cursors, you can do something like this:
mylist = []
with arcpy.da.SearchCursor(FC, '*') as rows:
idx = rows.fields.index("Coolfield")
…
0
votes
1000 features limit using CopyFeatures_management?
import arcpy
arcpy.env.overwriteOutput=True
arcpy.env.workspace = "Database Connections\\CNTM_MAC_GIS(EPRD-SHS12-LTR,62246).sde"
arcpy.MakeFeatureLayer_management("CMTEN_MAC_GIS.dbo.tben_SCSGPSData", … gps_points')[0], 'points selected'
saved_to="W:\MAC\GIS\Client_Requests\Stats\gps.gdb\gpspoints"
arcpy.CopyFeatures_management("gps_points", saved_to)
print "done"
Or maybe this approach:
import arcpy …
0
votes
Accepted
Updating attribute table of base shapefile from .csv file?
When working with arcpy cursors it's often easier to just grab all the records and work with the data using basic Python functions. … Note: I don't have Arc anymore so I wrote this example from memory and some of the arcpy-specific code might not be right. …
1
vote
Linearly comparing one point to all points within 20' foot area, for every point in dataset ...
In this type of analysis it can be nice to jump out of nested cursors and buffers and work directly on the data with a spatial index. In doing similar work I've found that using the rtree library cuts …
2
votes
How is arcpy.Clip_analysis() so fast against non-arcpy implementations?
Lack of a spatial index. You're evaluating every point for intersection whether or not it's likely to be a candidate.
If you want to do it in Python, you should use something like Rtree to quickly we …
0
votes
Insert cursor only copies 80% of data due to lock?
Unless you need to skip a row, row1 = cursor1.next() isn't needed when you're already in a loop like for row1 in cursor1:. The loop will automatically go to the next record for you.
Next problem is t …
0
votes
Insert cursor only copies 80% of data due to lock?
An alternative to doing the looping would be to use a sql query in one of the search cursors (untested):
with arcpy.da.InsertCursor(newtable_path) as output_cursor:
with arcpy.da.SearchCursor(sta …
2
votes
Accepted
Using Select by Attribute expression in ArcPy?
I suspect it doesn't run on OID #3 because when it joins the statistics table on OID #2 the field names get modified internally. Try removing the join in your cleanup step.
If you don't need the sele …
0
votes
Using an SQL Query in arcpy
You might be able to convert the table to a numpy array:
import numpy
...
np = arcpy.da.TableToNumPyArray("distanceTable", ["Distance"])
buffer_distance= np["Distance"].max()