2

I have some large features that I need to split into smaller pieces for terrain alignment through vertices in another program. I figured triangles would be the best solution.

So basically I want to turn this:

enter image description here

into this:

enter image description here

Sadly the latter image is a mockup. I had some success with the fishnet tool and intersecting to create rectangles, but I can't get triangles out of it. Rotating the net doesn't work because the rectangles aren't square. Any ideas that don't involve manual cutting?

1 Answer 1

3

One of multiple solutions. Create points inside polygon, fishnet will do. Add vertices of polygons to this set. Create TIN. Export tin triangles and clip them: enter image description here

Updated answer on points creation. Script below works from ArcGIS and takes 3 parameters:

  1. Layer in TOC. Used to define extent.
  2. Distance between points, type double
  3. Points layer (empty)

import arcpy, traceback, os, sys extentLayer = arcpy.GetParameterAsText(0) xStep = float(arcpy.GetParameterAsText(1)) destLayer = arcpy.GetParameterAsText(2)

try:
    def showPyMessage():
        arcpy.AddMessage(str(time.ctime()) + " - " + message)
    def isLayerExist(lName):
        layer = arcpy.mapping.ListLayers(mxd,lName)[0]
        ext=layer.getSelectedExtent()
        return (layer,ext)
    mxd = arcpy.mapping.MapDocument("CURRENT")
    destLayer, anExt=isLayerExist(destLayer)
    extentLayer, anExt=isLayerExist(extentLayer)
    yMin,yMax,xS,xE=anExt.YMin,anExt.YMax,anExt.XMin,anExt.XMax
    yStep=xStep/2*math.pow(3.0,0.5)
    curT = arcpy.da.InsertCursor(destLayer,"SHAPE@")
    p=arcpy.Point()
    iMax=int((yMax-yMin)/yStep)+2
    jMax=int((xE-xS)/xStep)+2
    for i in range(iMax):
        Y=yMin+i*yStep
        xStart=xS+i%2*xStep/2
        xEnd = xE +i%2*xStep/2
        for j in range(jMax):
            X=xStart+j*xStep
            p.X,p.Y=X,Y
            theRow=(p,)
            curT.insertRow(theRow)
except:
    message = "\n*** PYTHON ERRORS *** "; showPyMessage()
    message = "Python Traceback Info: " + traceback.format_tb(sys.exc_info()[2])[0]; showPyMessage()
    message = "Python Error Info: " +  str(sys.exc_type)+ ": " + str(sys.exc_value) + "\n"; showPyMessage()            
7
  • 1
    +1 Good solution. To clean up the slivers, you could use the Eliminate (Data Management) tool.
    – Aaron
    Commented Apr 12, 2015 at 20:25
  • Thanks, but could you clarify the TIN creation? I created the fishnet using the polygon as border, used the "feature vertices to points" tool to create points and then used the create TIN tool with the points as input.. but that results in a single opaque surface. The other TIN tools aren't helping either..
    – MapEngine
    Commented Apr 12, 2015 at 21:00
  • 1
    Convert TIN to triangles (3d-Conversion-From TIN)
    – FelixIP
    Commented Apr 12, 2015 at 21:54
  • Great - that did it. One last question though, how did you generate your points? They're not from a grid. My result looks like this: i.imgur.com/Q248uxr.png (which is what I wanted, just curious).
    – MapEngine
    Commented Apr 12, 2015 at 23:27
  • 1
    I've made a script in Avenue (ArcView 3) ages ago, it makes equal distance points, inputs: required distance and extent. Shall I update my answer with this code? It can be easily done in Excel as well, if you don't know Avenue
    – FelixIP
    Commented Apr 12, 2015 at 23:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.