|
POST
|
Others are reporting the same issue, currently with no solution.
... View more
02-22-2015
02:32 PM
|
0
|
0
|
1548
|
|
POST
|
I'm confused by this response - the link does not lead to anything specifically to do with arcpy, rather a tool, which like any tool can be called via arcpy, but as far as I can tell it does not have anything to do with setting locator properties.
... View more
02-22-2015
02:26 PM
|
0
|
1
|
3237
|
|
POST
|
Brandon, it doesn't look like it. Check this link with similar discussion.
... View more
02-22-2015
02:24 PM
|
2
|
1
|
3237
|
|
BLOG
|
Hi Dan, Thanks for this example. Just to be the devil's advocate, I'll add that I'm still not exactly sold on the practicality of using it. As far as I can tell, you save yourself two lines in the two_arg loop (over making 3 individual calls), and nothing at all in the one-arg loop. result = getattr(arcpy, one_arg[0])(*args) can be rewritten as: result = arcpy.AddXY_management(outputs) and... result_bak = getattr(arcpy, one_arg[1])(result,backups) can be rewritten: result_bak = arcpy.CopyFeatures_management(outputs,backups) Unless you're looping through tools, there is no benefit I can see and it reduces readability (for me, at least). I do admit that this is a slick way to loop through tools, however, you need a special script that requires multiple tools with the exact same combination of parameters in order to take advantage of it. I'd be interested to see a spreadsheet listing tools vs parameter type to see which tools would be compatible with each other.
... View more
02-20-2015
11:36 AM
|
1
|
0
|
1157
|
|
POST
|
Hmmm not sure why it doesn't work for you. Is your line feature class projected? If not, that may affect the calculated distances between points, which would affect the angle calculations.
... View more
02-20-2015
09:49 AM
|
0
|
2
|
2444
|
|
POST
|
Are your expected areas either 1,000,000 (meters) or 10,764,000 (feet) times too large, by chance?
... View more
02-19-2015
10:08 PM
|
0
|
0
|
1322
|
|
POST
|
In ArcMap, copy/paste the code into the Python window (under Geoprocessing menu). Change the name of the layer in the SearchCursor (keep within quotes). It will output to an in_memory layer called lines and add it to your map. You can export that layer to one on disk, or change the script to save to a new location (e.g. substitute r'C:\someFolder\someShapefile.shp' for r'in_memory\lines'). "SHAPE@" is a geometry token - don't change it. You can think of it as "the geometry".
... View more
02-19-2015
03:37 PM
|
0
|
4
|
2444
|
|
DOC
|
Can you provide an example where this could be useful? I came up with the following (maybe you don't know if you want to 'AddXY_management' or 'RepairGeometry_management' or any other one-parameter tool), but am having a hard time thinking how you could write much code beyond a simple tool call that applies to multiple tools: import arcpy tool = arcpy.GetParameterAsText(0) input = arcpy.GetParameterAsText(1) arguments = [input] result = getattr(arcpy, tool)(*arguments)
... View more
02-19-2015
02:19 PM
|
0
|
0
|
3150
|
|
POST
|
You may also be interested in tracing the existing border to get started on your new polygon. If not, perhaps you could provide a picture of your exact problem.
... View more
02-19-2015
11:19 AM
|
1
|
2
|
4694
|
|
POST
|
Although this doesn't answer your current question, you should really look into updating your workflow to take advantage of topological editing (editing shared borders). You can also use topological tools to align a mismatched edge.
... View more
02-19-2015
10:58 AM
|
1
|
5
|
4694
|
|
POST
|
Not exactly sure I've captured what you want, but this script will cycle through all the lines in a polyline feature class, and output lines up until it reaches an acute angle. >>> import math
... lines = []
... with arcpy.da.SearchCursor("YOUR_POLYLINE_FC_HERE","SHAPE@") as cursor:
... for row in cursor:
... for part in row[0]:
... linePnts = []
... writePnt = 1
... pt_count = 1
... for pnt in part:
... pnt = arcpy.PointGeometry(pnt)
... if pt_count > 1:
... if pt_count >2:
... distAB = oneBack.distanceTo(twoBack)
... distBC = pnt.distanceTo(oneBack)
... distAC = pnt.distanceTo(twoBack)
... angB = math.degrees(math.acos((((distAB*distAB)+(distBC*distBC))-(distAC*distAC))/(2*distAB*distBC)))
... if angB < 90:
... writePnt = 0
... twoBack = oneBack
... oneBack = pnt
... pt_count += 1
... if writePnt == 1:
... linePnts.append(arcpy.Point(pnt.centroid.X,pnt.centroid.Y))
... line = arcpy.Polyline(arcpy.Array(linePnts))
... lines.append(line)
... arcpy.CopyFeatures_management(lines,r'in_memory\lines')
... View more
02-19-2015
10:33 AM
|
0
|
6
|
2444
|
|
POST
|
Yes, this is a job for Page Definition Query. Your index layer (species) will cycle through species, and setting the Page Definition Query to match, will only show the matching species.
... View more
02-19-2015
08:57 AM
|
1
|
0
|
538
|
|
POST
|
This wouldn't take too long to do per folder simply through the GUI and batch processing. One batch for Add Field (area), one batch for Calculate Field, and finally Summary Statistics to add up the areas. Of course, if you have many folders, you'd want to automate it with a model or script.
... View more
02-19-2015
08:49 AM
|
0
|
0
|
6253
|
|
POST
|
I'll preface this by saying this is a dangerous script, not to be attempted unless you know what you're doing. It will overwrite your original data, so make a backup. You can permanently sort your records using the following script. Beware that once sorted and updated, the object ID will update from 0 - end. >>> data = []
>>> with arcpy.da.SearchCursor("csv_points","*") as cursor:
... for row in cursor:
... data.append(row)
...
>>> data.sort(key=lambda tup: tup[6]) # sorts based on the 7th field, change if you want.
>>> count = 0
>>> with arcpy.da.UpdateCursor("csv_points","*") as cursor:
... for row in cursor:
... row = data[count]
... count += 1
... cursor.updateRow(row)
... View more
02-18-2015
01:54 PM
|
0
|
1
|
1553
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-30-2013 02:22 PM | |
| 1 | 04-12-2011 11:19 AM | |
| 1 | 09-17-2021 09:43 AM | |
| 1 | 04-04-2012 12:05 PM | |
| 2 | 07-16-2020 11:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|