|
POST
|
Have you read this help page: Joining attributes of one table to another? Also, is this what you mean by join (adding matching columns onto records based on a matching attribute value)? Sometimes people say "join" and mean something else entirely.
... View more
02-09-2015
01:25 PM
|
0
|
4
|
2404
|
|
POST
|
Can you compare statewide point density variance? It looks like the main difference is that point density is more variable (more clumps and voids) in the optimized surface than the more even original surface.
... View more
02-08-2015
09:11 PM
|
0
|
1
|
984
|
|
POST
|
Here's how you can do this using arcpy and geometry objects: >>> radius = 200000 # buffer radius
>>> polys = []
>>> sr = arcpy.Describe("YOUR_POINT_LAYER_NAME_HERE").spatialReference
>>> with arcpy.da.SearchCursor("YOUR_POINT_LAYER_NAME_HERE","SHAPE@",'#',sr) as cursor:
... for row in cursor:
... pt1 = row[0].centroid
... pt2 = arcpy.Point(row[0].centroid.X - radius*2, row[0].centroid.Y)
... pt3 = arcpy.Point(row[0].centroid.X - radius*2, row[0].centroid.Y - radius*2)
... triangle = arcpy.Polygon(arcpy.Array([pt1,pt2,pt3]),sr)
... buffer = row[0].buffer(radius)
... wedge = triangle.intersect(buffer,4)
... polys.append(wedge)
...
>>> arcpy.CopyFeatures_management(polys,'in_memory\wedges')
<Result 'in_memory\\wedges'> It helps that all wedges are the same shape, so the triangle shape used to clip (intersect) the buffer is hard-coded. You could fairly easily alter the script to respond to attribute data. Sorry for swooping in on your fun, Xander
... View more
02-08-2015
03:24 PM
|
3
|
15
|
5100
|
|
POST
|
It matters whether or not you run scripts within an ArcMap session, and within that session whether the script is run as a tool or from the Python window. Your error is actually due to not importing the arcpy library. It is auto-loaded in ArcMap, but not standalone PyScripter. Make ' import arcpy ' (no quotes) the first line in a standalone arcpy script. You are correct, though, that the ' CURRENT ' mxd will not be available standalone; reference it by file path.
... View more
02-08-2015
09:56 AM
|
1
|
0
|
1309
|
|
POST
|
That was my fault - I ran my test on a feature class called "ex_centroid". I've updated the script to say "YOUR_POINT_LAYER_NAME" in the Spatial Join call (so, change that to your own).
... View more
02-07-2015
12:46 PM
|
0
|
2
|
2960
|
|
POST
|
This script will make 100 copies of each feature in the feature class "Your point layer name" (of course, change that to your later name). Change the number of duplicates if you want. This script can go into the Python window, accessed under the geoprocessing menu in ArcMap.
... View more
02-07-2015
11:56 AM
|
0
|
5
|
2960
|
|
POST
|
If I'm reading this right, your main question is how to duplicate geometries. Here's how, using Python: >>> duplicates = 100
>>> points = []
>>> with arcpy.da.SearchCursor("YOUR_POINT_LAYER_NAME",["SHAPE@"]) as cursor:
... for row in cursor:
... for i in range(duplicates):
... points.append(row[0])
...
>>> arcpy.CopyFeatures_management(points,'in_memory\out_points')
<Result 'in_memory\\out_points'>
>>> arcpy.SpatialJoin_analysis("out_points","YOUR_POINT_LAYER_NAME",r'in_memory\sp_join_output',"JOIN_ONE_TO_ONE","KEEP_ALL",'#',"ARE_IDENTICAL_TO")
<Result 'in_memory\\sp_join_output'>
... View more
02-07-2015
11:36 AM
|
0
|
7
|
2960
|
|
POST
|
The line containing writerow is not within a loop, so it only writes once, after the code exits the for loop. Indent further to include in the loop and write multiple rows.
... View more
02-05-2015
11:22 AM
|
2
|
2
|
10336
|
|
POST
|
This works for me (resulting in '1.pdf', '2.pdf', '3.pdf', etc.): >>> import os
>>> mxd = arcpy.mapping.MapDocument("CURRENT")
>>> for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
... mxd.dataDrivenPages.currentPageID = pageNum
... name = str(pageNum) + ".pdf"
... arcpy.mapping.ExportToPDF(mxd, os.path.join("C:\junk", name))
... View more
02-04-2015
12:53 PM
|
0
|
1
|
1788
|
|
POST
|
Okay, what does "it doesn't work" mean? Is there an error? If so, what is it?
... View more
02-04-2015
12:29 PM
|
0
|
0
|
1788
|
|
POST
|
Does it work if you add a '\' in the path? arcpy.mapping.ExportToPDF(mxd, r"D:\Temp\" + str(pageName) + ".pdf")
... View more
02-04-2015
11:10 AM
|
0
|
2
|
1788
|
|
POST
|
You shouldn't need elevations for your structures - simply subtract a reasonable value from your DEM at each structure. 1.) Polygon to Raster, as Jake suggests. 2.) Subtract a value (e.g. 10m) from your DEM: Con (IsNull("structures"), "DEM", "DEM"-10)
... View more
02-04-2015
08:03 AM
|
1
|
0
|
11370
|
|
POST
|
Here's my five minute solution: 1.) Add and calculate a field in your fiber feature class to equal 1 for all rows. 2.) Convert to raster (requires Spatial Analyst, I believe), using new column as value. Now have fiber raster layer, all with value = 1. 3.) Run Cost Distance tool (requires Spatial Analyst), using new raster as cost surface and hub as source. 4.) Extract resulting cost distance values to node points. This will only transfer distances to nodes if they happen to fall on the fiber raster. If not, need to edit nodes so they fall on raster and rerun. This was done somewhat naively, not knowing if there are geometrical consequences calculating continuous distances between square pixels, but the values seem reasonable.
... View more
02-03-2015
02:26 PM
|
1
|
5
|
1266
|
|
POST
|
If you want to update for each row, place cursor.updateRow(row) at the same indentation level as the if/else.
... View more
02-02-2015
11:54 AM
|
2
|
0
|
2760
|
|
POST
|
Sorry, Chris. That was nonworking, untested code. I believe something like this should work: def StreetSuffix(fa):
list = fa.split()
for i in range(len(list)):
if list == 'RD':
list = list.replace("RD","ROAD")
if list == 'TRAIL':
list = list.replace("TRAIL","TR")
....and so on
return " ".join(list) This should work, however, I see now that it would probably be much more concise to use a dictionary.
... View more
01-29-2015
01:18 PM
|
1
|
1
|
5161
|
| 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
|