|
POST
|
Use the Project tool to apply a projection to your layer. The projection will have a linear unit (e.g. metres) associated with it. When you rerun Point Distance, the units will be in the linear unit of the input feature class.
... View more
07-24-2015
01:48 PM
|
0
|
5
|
2718
|
|
POST
|
Here's a script that should do what you're after: >>> newLines = []
... points = "grid_label"
... angleField = "OID"
... lineLength = 300
... sr = arcpy.Describe(points).spatialReference
... with arcpy.da.SearchCursor(points,["SHAPE@",angleField],spatial_reference=sr) as cursor:
... for row in cursor:
... x1 = row[0].centroid.X + (math.sin(math.radians(row[1]))*(lineLength/2))
... y1 = row[0].centroid.Y + (math.cos(math.radians(row[1]))*(lineLength/2))
... x2 = row[0].centroid.X - (math.sin(math.radians(row[1]))*(lineLength/2))
... y2 = row[0].centroid.Y - (math.cos(math.radians(row[1]))*(lineLength/2))
... newLine = arcpy.Polyline(arcpy.Array([arcpy.Point(x1,y1),arcpy.Point(x2,y2)]),sr)
... newLines.append(newLine)
... arcpy.CopyFeatures_management(newLines,r'in_memory\lines')
... View more
07-24-2015
01:29 PM
|
2
|
1
|
1896
|
|
POST
|
This can be broken down into a few separate steps, all possible within ArcGIS. Also, while you can probably manage to make this work without any third party tools, I have access to ET GeoWizards, which greatly simplifies the process, so I'll describe it in those terms. 1.) Create centreline. 2.) Create perpendicular station lines. 3.) Intersect station lines with polygon. 4.) Inspect widths.
... View more
07-24-2015
10:31 AM
|
1
|
1
|
1594
|
|
POST
|
Won't pretend to understand why this works and my previous suggestion didn't, but this seems to work: >>> with arcpy.da.InsertCursor(An,['SHAPE@XY']) as cursor:
... cursor.insertRow([(x,y)])
... View more
07-23-2015
04:39 PM
|
2
|
0
|
5569
|
|
POST
|
Oh, you've listed 'SHAPE@XY' (itself a tuple), inside another tuple. Try: cursor.insertRow(((x,y))) ... or remove the parentheses around 'SHAPE@XY'.
... View more
07-23-2015
03:45 PM
|
0
|
2
|
5569
|
|
POST
|
You need to fill the fields passed in the cursor initiation statement. Because SHAPE@XY is tuple, you must fill that tuple when you call insertRow. See the second code sample here. with arcpy.da.InsertCursor(An,('SHAPE@XY')) as cursor:
cursor.insertRow( (x,y) ) As a side question, how are you planning to capture a click event as text? Is this a Python add-in? It may be possible, I've just never seen this.
... View more
07-23-2015
03:18 PM
|
0
|
4
|
5569
|
|
POST
|
In that case, quite different description than the original btw, you should look into Zonal Statistics, SUM. You may find it easier to create a new raster with absolute values of biomass per pixel, rather than adding biomass per acre, but it's up to you.
... View more
07-23-2015
03:03 PM
|
2
|
0
|
17016
|
|
POST
|
Have you identified the rock outcroppings in your image? If not, is it an RGB or multispectral image? If multispectral (or even RGB, potentially) start here for more information about image classification. I assume you'll want to go with supervised classification (i.e. draw some training polygons around known rock outcroppings, then extrapolate those spectral signatures to the rest of your image). Once you've identified the outcroppings, run Region Group to identify distinct outcroppings. Then, convert the grouped outroppings raster to polygon. Finally, run the Near tool to get the distance from each outcropping to the next nearest outcropping (requires advanced license).
... View more
07-23-2015
02:42 PM
|
2
|
0
|
2200
|
|
POST
|
The arguments for AddField are, (in_table, field_name, field_type), in that order. Check syntax section here. arcpy.AddField_management(fc, row[0], fieldtypes[row[1][:4]]) fc = the input table row[0] = the field name (the first column in your spreadsheet. E.g. 'geodb_oid') row[1][:4] = the first four characters of the second column in your spreadsheet (e.g. 'inte') fieldtypes[row[1][:4]] = the value associated with the key 'inte' (e.g. 'LONG')
... View more
07-23-2015
10:52 AM
|
0
|
1
|
1169
|
|
POST
|
Ah, this one's easy. Python is case sensitive - it should be AddField, not Addfield.
... View more
07-23-2015
09:22 AM
|
1
|
3
|
2881
|
|
POST
|
I was being kind of lazy making the dictionary because I wasn't quite sure how your data looked. fieldtypes[row[1][:4]] ...means: take the first four letters of the value in row[1], find the dictionary key that matches that value, and return the value at that key in the dictionary. Since there is no such value in your dictionary, it returns an error. When I made the example dictionary, I shortened the dictionary keys to four letters ("integer" became "inte") so there would be matches.
... View more
07-23-2015
08:24 AM
|
0
|
5
|
2880
|
|
POST
|
Can you use, and do you get the same error with CopyFeatures_management rather than Copy_management?
... View more
07-22-2015
03:27 PM
|
0
|
1
|
1831
|
|
POST
|
Try adding a second Parse Path tool to the Name variable, set to Path, and named "PATH". Then, change your Clip tool to look for: %PATH%/%FILENAME%.shp
... View more
07-22-2015
02:46 PM
|
0
|
0
|
3801
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-25-2015 01:51 PM | |
| 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 |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|