|
POST
|
A very good approximation of the trapezoid top width could be had using a version the "divide and conquer" method described above. This method would not require any simplification of the shape, but would require a bunch of python code, and it assumes that you have a shape that is somewhere in between a rectangle and a triangle (e.g. an elongated trapezoid). We've already demonstrated that it's pretty easy to get the length of the bottom width edge, and the constituent coordinates of it... The idea then (somewhat similar to the one presented above), would be to derive the minimum convex rectangle, and then construct a series of line bisectors (the more bisectors the better approximation) where the bisectors are at equal increments, say 1% increments, from the right most (or left most) end of the rectangle - we'll call that the "origin" end. The method then would be to "clip" the bisector lines to the trapezoid polygon and then examine the resulting lengths as a function of the distance from the origin end... The linear regression of these lengths/increment distances would then describe the tapper of the trapezoid, and thus, knowing the tapper equation and the rectangle length , you could then estimate an approximate width of the top end of the trapezoid.
... View more
12-16-2011
08:29 AM
|
1
|
0
|
3192
|
|
POST
|
Yep - Also, if you wanted to "variabalize" the field names (use the field names as varaibles) it would look like: from numpy import *
import arcpy
rows = arcpy.SearchCursor("Z://Code//EX2_near.dbf","","","","")
currentIN_FID = "IN_FID"
currentNear_FID = "NEAR_FID"
currentNear_Dist = "NEAR_DIST"
newdata = []
# Iterate through the rows in the cursor
for row in rows:
rowN = [row.getValue(currentIN_FID), row.getValue(currentNear_FID), row.getValue(currentNear_Dist)]
newdata.append (rowN)
del row, rows #be sure to delete the cursor objects, otherwise a lock on the table will persist!!!
print newdata
datatwo = array([newdata])
... View more
12-16-2011
07:06 AM
|
0
|
0
|
1399
|
|
POST
|
Would you entertain a method that would give approximate widths (say within 10ft) of the true width?
... View more
12-15-2011
04:01 PM
|
0
|
0
|
12299
|
|
POST
|
I don't have an example, but basically you would have to use a search cursor to loop through the fields and records. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002z0000001q000000
... View more
12-15-2011
02:04 PM
|
0
|
0
|
1399
|
|
POST
|
If you are interested: A quick way in Python to get a list (and thus counts) of selected feature OIDs in a feature layer where the feature layer contains some selected records: #in this case, "roads" is the name of a feature layer that has selected records (selected by the SelectByLocation tool)
#works "pretty" fast - v10.0 is much faster than v9.3
fidSetList = [int(fid) for fid in arcpy.Describe("roads").fidSet.split(";")]
... View more
12-15-2011
12:20 PM
|
0
|
0
|
1066
|
|
POST
|
I wonder if you could simplify all the polygons that had > 4 verticies to the point where they had only four constitient verticies (maybe uysing the SimplifyPolygon tool). Probably have to be scripted to keep checking/adjusting the tolerances and resulting vetex counts (feature by feature) untill you get the magic count of four verticies. Then examining the length of the (now exactly 4 sided) polygon edges, where the two shortest edges will be your min/max base widths (aka the trapezoid top and bottom).
... View more
12-15-2011
11:50 AM
|
1
|
0
|
12299
|
|
POST
|
You could probably even get the base width using a Python expression in the field calculator. See this: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002z0000001s000000 The "built-in" .hullrectangle geometry property gives you the coordinate pairs of the corners of the convex hull rectangle that encompasses the extent of a polygon. Think of it as an extent polygon that is tilted in such a way to minimize the extent area. The !Shape.hullRectangle! expression returns a string like: 611210.287367493 1143140.09588692 611179.291388619 1143388.50437016 611781.906192586 1143463.69759822 611812.90217146 1143215.28911498 Where the 1st and 2nd coordinate pairs "seem" to always describe the WIDTH (not the length) of the rectangle, which would be your maximum base width. What's that Pythag. theorem again? Getting the minimum base width (the skinny part at the top of your trapezoids) would be quite tricky. However, if there are always only 4 coordinate that make up the trapezoid shape, well then that would be easy.
... View more
12-15-2011
09:14 AM
|
1
|
0
|
12299
|
|
POST
|
Not sure how you would pull that off if you wanted rectangular polygons... Irregular polygons would be pretty easy though. Some sort of Theisen polygons coupled with a recursive select by location?
... View more
12-13-2011
03:34 PM
|
0
|
0
|
1066
|
|
POST
|
You need to unquote your variables. Try this: import arcpy
from arcpy import env
try:
#Functions
inTest = arcpy.GetParameterAsText(0)
clipArea = arcpy.GetParameterAsText(1)
outFeature = arcpy.GetParameterAsText(2)
arcpy.env.workspace = "S:/TallPinesGIS/Data"
# Add Field to Polygon for ranking
arcpy.Addmessage('Adding Fields')
arcpy.AddField_management(inTest,"TEST","SHORT","2","#","#","#","NON_NULLABLE","NON_REQUIRED","#")
# Clip Features to current Project Area
arcpy.Addmessage('Clipping features outside of project area')
arcpy.Clip_analysis(inTest,clipArea,outFeature,"#")
except:
print arcpy.GetMessages()
... View more
12-12-2011
07:50 AM
|
0
|
0
|
895
|
|
POST
|
Transforming between NAD83 to WGS84 requires a datum transformation method, and it looks as if you are not supplying that parameter. If you are in the lower 48, "NAD_1983_To_WGS_1984_5" should work. See: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//003r00000010000000.htm
... View more
12-06-2011
11:30 AM
|
0
|
0
|
1411
|
|
POST
|
Try using a different field than OBJECTID from your AOI polygon. Used to be that OBJECTID wasn't an allowed field for any SA tools. Now it seems to be okay, but sometimes the ESRI tools revert to past behaviors... What if you use the "ALL" default for the statistic type? Better yet, just use "" to force the default value.
... View more
12-06-2011
11:22 AM
|
0
|
0
|
2566
|
|
POST
|
I ran a little test, and I was able to use Band_1 from a multiband .tif in the Zonal Statistics as Table tool via ArcToolbox. arcpy.ZonalStatisticsAsTable(roadshedFC, "ROADSHED_ID", r"C:\temp\test.tif\Band_1", outZnStatsTbl, "", "ALL") Maybe it's just the map algebra is wonkey... Does the toolbox tool work for you?
... View more
12-06-2011
08:35 AM
|
0
|
0
|
2566
|
|
POST
|
What if you convert band1 of your .tif to a grid... Does it work then? Maybe ZonalStats doesn't like using multiband .tif files as input?
... View more
12-06-2011
07:28 AM
|
0
|
0
|
2566
|
|
POST
|
Try Tab1_1 = ZonalStatisticsAsTable(AOI, "OBJECTID", Img1_1, tab_1_1, "", "MINIMUM") instead of Tab1_1 = ZonalStatisticsAsTable(AOI, "OBJECTID", Img1_1, "tab_1_1", "", "MINIMUM")
... View more
12-06-2011
07:21 AM
|
0
|
0
|
2566
|
|
POST
|
Use the MultipartToSinglepart tool (via ArcToolbox). There is also the "Explode polygon" tool if you are in edit mode.
... View more
12-04-2011
02:56 PM
|
0
|
0
|
589
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-25-2014 12:57 PM | |
| 1 | 08-29-2024 08:23 AM | |
| 1 | 08-29-2024 08:21 AM | |
| 1 | 02-13-2012 09:06 AM | |
| 2 | 10-05-2010 07:50 PM |
| Online Status |
Offline
|
| Date Last Visited |
08-30-2024
12:25 AM
|