|
POST
|
I'm not quite sure how this differs from your original script, but this works for me: my_lyr = 'qs' # the feature layer name
lyr_file = r'C:\junk\mylyr.lyrx' # the symbology layer file
arcpy.ApplySymbologyFromLayer_management(my_lyr,lyr_file) # apply symbology
... View more
02-20-2017
01:15 PM
|
0
|
5
|
3145
|
|
POST
|
You can use the Select geoprocessing tool to do this in a single step.
... View more
02-16-2017
09:17 AM
|
3
|
0
|
2720
|
|
POST
|
Can you post a screenshot of your attribute table? It really matters how you've got it set up (e.g. is each individual point a separate feature linked to its pair by an ID, or are there from-to coordinates in a single feature?).
... View more
02-16-2017
09:11 AM
|
0
|
0
|
5041
|
|
POST
|
I can't help you with the fact that there is no parameter for search neighbourhood, but if you post your script leading up to the error, we may be able to figure that out.
... View more
02-15-2017
01:08 PM
|
0
|
0
|
3740
|
|
POST
|
Glad to hear it. No, I don't know why you got that error. It looks like others who had the same error fixed it by saving to a different location (like you), or to a different file format, or setting the workspace environment, or other environments, etc. It looks like one of those errors that can be caused by many things, or nothing at all!
... View more
02-15-2017
10:35 AM
|
0
|
0
|
4177
|
|
POST
|
Further to Dan's suggestion, I'd say the easiest solution is to use arcpy. Create a temporary polyline geometry in between the points, and use its positionAlongLine(value) method to make the new point.
... View more
02-15-2017
10:05 AM
|
1
|
0
|
5041
|
|
POST
|
Sure, those are good rules of thumb for any project.
... View more
02-15-2017
09:34 AM
|
0
|
2
|
25452
|
|
POST
|
You should be able to use a raster calculator expression like: Con(IsNull("PINK_RASTER"),"BROWN_RASTER")
... View more
02-15-2017
09:20 AM
|
3
|
7
|
25452
|
|
POST
|
I don't know the answer to your overall problem, but your picture (A->B->C) is basically describing Linear Referencing, specifically Locating Features Along Routes:
... View more
02-14-2017
09:07 AM
|
1
|
0
|
3001
|
|
POST
|
You're missing the final close parenthesis in Line 9: list_snappingtooltest_names.append(row.getValue("LRSLRM"))
... View more
02-13-2017
12:40 PM
|
1
|
1
|
4418
|
|
POST
|
Can you quickly post a screenshot of the attribute table showing the 17 points?
... View more
02-10-2017
02:00 PM
|
0
|
1
|
3967
|
|
POST
|
Errr... I used it for making those example images. I just made it up. This is all there is to it!
... View more
02-08-2017
02:21 PM
|
1
|
1
|
4197
|
|
POST
|
Fun Python task! I think it should go something like this: import random
pa = 'protected_areas' # protected areas
sr = arcpy.Describe(pa).spatialReference # spatial ref
sa = 'study_area' # study area
extent = arcpy.Describe(sa).extent # study area extent
sa_geom = [row[0] for row in arcpy.da.SearchCursor(sa,'SHAPE@',spatial_reference=sr)][0] # study area geometry
new_polys = [] # placeholder
def rotate(poly,centroid): # magic function
ang = random.random() * 2 * math.pi # random rotation angle in radians
new_array = arcpy.Array() # placeholder
rnd_x = random.uniform(extent.XMin,extent.XMax) # random x coordinate for new centroid
rnd_y = random.uniform(extent.YMin,extent.YMax) # random y coordinate for new centroid
rnd_centroid = arcpy.Point(rnd_x,rnd_y) # centroid point
for part in poly: # for each polygon part
for pnt in part: # for each vertex
x_trans = pnt.X - centroid.X # normalize to zero
y_trans = pnt.Y - centroid.Y # normalize to zero
x_transprime = (math.cos(ang) * x_trans) - (math.sin(ang) * y_trans) # new x coord, from zero
y_transprime = (math.sin(ang) * x_trans) + (math.cos(ang) * y_trans) # new y coord, from zero
x_prime = x_transprime + rnd_centroid.X # move to new centroid x
y_prime = y_transprime + rnd_centroid.Y # move to new centroid y
new_array.add(arcpy.Point(x_prime, y_prime)) # add to array
candidate_poly = arcpy.Polygon(new_array,sr) # make polygon from array
for new_poly in new_polys: # compare to polygons already added to new_polys
if not candidate_poly.disjoint(new_poly) or not sa_geom.contains(candidate_poly): # check if overlap with polygons and is fully inside study area
candidate_poly = rotate(poly,centroid) # if the new polygon violates criteria, call function again
return (candidate_poly) # return the final good polygon
with arcpy.da.SearchCursor(pa,'SHAPE@',spatial_reference=sr) as cursor: # for each polygon
for row in cursor:
centroid = row[0].centroid # calculate centroid
new_polys.append(rotate(row[0],centroid)) # add returned good polygon to list
arcpy.CopyFeatures_management(new_polys,r'in_memory\new_polys') # write to disk * rotation math from here: Rotating Features in ArcGIS for Desktop using ArcPy? - Geographic Information Systems Stack Exchange
... View more
02-08-2017
11:48 AM
|
4
|
7
|
4197
|
|
POST
|
The way the problem is described, they want Viewshed in this case, so there shouldn't be an issue.
... View more
02-07-2017
08:54 PM
|
0
|
1
|
3139
|
| 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
|