|
POST
|
This will return either interior or exterior angles. I didn't know what you want to do with the list, so this example simply prints the list of interior angles for a featureclass with 6 polygons. import numpy as np
import arcpy
def _poly_arr_(poly):
"""Return coordinates of nested objects."""
def _split_(part):
yield [(p.X, p.Y) for p in part if p]
# ----
arrs =[]
for part in poly:
out = []
w = np.where(np.isin(part, None, invert=False))[0]
bits = np.split(part, w)
for i in bits:
sub = _split_(i)
out.append(np.array(*sub).squeeze())
arrs.append(np.asarray(out).squeeze())
return np.asarray(arrs)
def _angles_(a, inside=True, in_deg=True):
"""Worker for Geo `polygon_angles` and `polyline_angles`.
Parameters
----------
inside : boolean
True, for interior angles.
in_deg : boolean
True for degrees, False for radians.
"""
# ----
def _x_(a):
"""Cross product. see npg_helpers as well."""
ba = a - np.concatenate((a[-1, None], a[:-1]), axis=0)
bc = a - np.concatenate((a[1:], a[0, None]), axis=0)
return np.cross(ba, bc), ba, bc
# ----
if np.allclose(a[0], a[-1]): # closed loop, remove dupl.
a = a[:-1]
cr, ba, bc = _x_(a)
dt = np.einsum('ij,ij->i', ba, bc)
ang = np.arctan2(cr, dt)
TwoPI = np.pi * 2.
if inside:
angles = np.where(ang < 0, ang + TwoPI, ang)
else:
angles = np.where(ang > 0, TwoPI - ang, ang)
if in_deg:
angles = np.degrees(angles)
return angles
# ----- Change the line below *******************************
in_fc = r"C:\Folder_to_your\shapefile.shp" # ---- not tested
with arcpy.da.SearchCursor(in_fc, "SHAPE@") as cur:
for row in cur:
geom = row[0]
arr = _poly_arr_(geom).squeeze()
ang = _angles_(arr, inside=True, in_deg=True)
print("angles\n{}".format(ang))
Results angles
[90. 90. 90. 90.]
angles
[ 36.86989765 63.43494882 34.69515353 225. ]
angles
[ 34.69515353 225. 36.86989765 63.43494882]
angles
[63.43494882 53.13010235 63.43494882]
angles
[ 90. 270. 90. 90. 270. 90. 90. 270. 90. 90. 270. 90.]
angles
[ 90. 90. 90. 90. 270. 90.] The featureclass
... View more
02-22-2020
02:39 AM
|
1
|
6
|
6410
|
|
POST
|
Are you on the same machine that you took it offline on? You have to check in/out on the same machine
... View more
02-21-2020
05:34 AM
|
0
|
0
|
1784
|
|
POST
|
Did you select a folder or a geodatabase as the destination? What type of field(s) are you using? Split By Attributes—Help | Documentation
... View more
02-20-2020
02:55 PM
|
1
|
1
|
1822
|
|
POST
|
Node counts is solely for polygons that meet at a single node and not along an edge. Since there is no obvious starting location, the deficit polygons will probably become the origins. The reductions in the surplus polygons will probably have to begin with moving surplus from them to satisfy deficits. In your example, it might be useful to see the surplus/deficits summarized by area and perimeter
... View more
02-20-2020
02:21 PM
|
2
|
1
|
2956
|
|
POST
|
It looks like a kwarg which is set to None, so perhaps it is using the None as the "optional" parameter and hence deletes nothing. That would follow python usage when defaults are provided to args or kwargs
... View more
02-20-2020
10:36 AM
|
0
|
0
|
877
|
|
POST
|
Attributes can be transferred to the table. The question becomes what do you want to do with what you have? I have used a text field (text) and an object id field (OID) as the transfer fields (Report by Fields option). The highlighted polygon has 8 neighbors, this may not be the case with a Voronoi Diagram (Theissen polygons). What is your observation of the number of neighbors? (is 8 most likely or is 4/5 more likely Do you only intend to process first order adjacency? Do you need to iterate until all deficits are satisfied by surpluses? Is there a distance limit through which a surplus can travel (ie, iterations can effectively 'move' surpluses until the everthing is uniform (floating-point values) or close to normal (integer values) You can relay the info to Esri Canada... tell them I sent you
... View more
02-20-2020
07:09 AM
|
1
|
3
|
2956
|
|
POST
|
Couldn't you use a value list with the default set to None (ie None, choice1, choice2), then simply have the tool check for None. If there is no selection (ie, None) then have the script fail to process anything and report why. There doesn't appear to be any "setEnabled" option to disable the Run button for any of the tool types to prevent people simply hitting Run with defaullts showing.
... View more
02-20-2020
06:27 AM
|
0
|
0
|
1418
|
|
BLOG
|
Start a question on GeoNet and post some sample data with the options you used to generate your output.
... View more
02-20-2020
04:27 AM
|
0
|
0
|
19840
|
|
POST
|
Calculate Field Python examples—Data Management toolbox | Documentation !shape.length@miles! I suspect, There is an explanation on how to calculate fields in the same area as well
... View more
02-19-2020
02:09 PM
|
0
|
0
|
698
|
|
POST
|
AddMessage—ArcPy Functions | Documentation But you will only see the messages when you use "View Details" on the tool after it runs. Messages don't display in a popup or anything like that
... View more
02-19-2020
11:42 AM
|
0
|
0
|
4383
|
|
POST
|
If there is no pattern, you may have to break them into groups and process accordingly. Sometimes there is no one-solves-all. You indicate that you have 10 featureclasses but 25000 records. It appears you are looking for a substring within a string. If it were you could use that information to parse the data first prior to determining whether to dissolve. cases = ['East Soil corrected 6th addition',
'East Soil corrected 5th addition',
'East Soil corrected 5th sub plat']
for c in cases:
if 'East Soil corrected' in c and 'addition' in c:
print("dissolve")
else:
print("don't dissolve")
dissolve
dissolve
don't dissolve
... View more
02-19-2020
07:29 AM
|
0
|
1
|
3016
|
|
POST
|
Are you looking for the access point to the sharing analysis and analyzer? Introduction to sharing analysis—ArcGIS Pro | Documentation Analyzer messages—ArcGIS Pro | Documentation
... View more
02-19-2020
07:21 AM
|
0
|
1
|
910
|
|
POST
|
There are key-mouse combinations here Keyboard shortcuts for navigation—ArcGIS Pro | Documentation don't see one for middle mouse only Addendum Apparently it is in the production plan https://community.esri.com/ideas/17748
... View more
02-19-2020
05:21 AM
|
0
|
0
|
2119
|
|
POST
|
sldpt ... is it initialized outside your loop? You increment it towards the bottom but it has no initial value Get rid on the searchcursor and replace it with a SelectLayerByAttributes arcpy.SelectLayerByAttribute_management("your_featureclass", 'NEW_SELECTION', '"Field_10" == 1') Since it appears the searchcursor is only looking for values of 1 in what I assume is your duplicates field (SCO1R (?)). Once the selection is made, only the selected records will be processed. Are you then are checking to see if field2 ==field3 (source and sink) and if so, are you then switching the source and sink and updating fields 8, 9 and 13 with new values, and incrementing the sldpt by 1. Not sure what preceeds this, but applying a selection and working with it will get rid of one cursor.
... View more
02-19-2020
02:40 AM
|
0
|
1
|
4340
|
|
POST
|
Do you have the bug number? The only issues related to overwriteOutput are related to certain machine architecture or shapefiles NIM064932: The Python overwriteoutput geoprocessor setting does.. or are ancient https://support.esri.com/en/Search-Results#search?q=OverwriteOutput&content-type=Bugs
... View more
02-19-2020
02:06 AM
|
0
|
0
|
2209
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-03-2017 11:39 AM | |
| 1 | 08-05-2019 05:21 PM | |
| 1 | 09-02-2016 08:05 AM | |
| 1 | 01-15-2018 01:10 PM | |
| 1 | 09-17-2018 12:48 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:22 AM
|