#aligned like a square (not equadistant) + + + + + + + + + + + + + + + +
#aligned like a tringle/diamond (equadistant) + + + + + + + + + + + + + + + +
Question: Do you want the points like this #aligned like a square (not equadistant) + + + + + + + + + + + + + + + + or like this:#aligned like a tringle/diamond (equadistant) + + + + + + + + + + + + + + + +If it's the former, just use the fishnet tool (and convert the polygon centroids to points using the FeatureToPoint tool), or as Darren suggests, use a raster/vector hybrid approach If it's the latter (which is what we use BTW to lay out our inventory plots), I think I have some code that I can borrow from someone. Let me know, and I'll try to post it (if they let me).
#Chris Snyder, WADNR, 20120126 import arcpy, math, random containerFC = r"C:\csny490\test.shp" outputFC = r"C:\csny490\out.shp" spacing = 100 useRandomShift = True arcpy.env.overwriteOutput = True dsc = arcpy.Describe(containerFC) dscExtent = dsc.extent xMin = dscExtent.xMin yMin = dscExtent.yMin xMax = dscExtent.xMax yMax = dscExtent.yMax randomXshift = random.uniform(0, spacing) randomYshift = random.uniform(0, spacing) yOffset = math.sqrt((spacing **2) - ((spacing / 2) **2)) pntDict = {} i = 0 rowNumber = 1 xCoord = xMin - spacing yCoord = yMin - spacing while xCoord < xMax + spacing or yCoord < yMax + spacing: i = i + 1 if xCoord > xMax + spacing: rowNumber = rowNumber + 1 xCoord = xMin - spacing if bool(rowNumber & 1) == False: xCoord = xCoord + spacing / 2 yCoord = yCoord + yOffset elif i == 1: xCoord = xCoord else: xCoord = xCoord + spacing if useRandomShift == True: pntDict = (xCoord + randomXshift, yCoord + randomYshift) else: pntDict = (xCoord, yCoord) arcpy.CreateFeatureclass_management(outputFC[:-len(outputFC.split("\\")[-1]) - 1], outputFC.split("\\")[-1], "POINT", "", "", "", dsc.spatialreference, "", "", "", "") shapeFieldName = arcpy.Describe(outputFC).shapeFieldName insertRows = arcpy.InsertCursor(outputFC) for pnt in pntDict: insertRow = insertRows.newRow() pointObj = arcpy.CreateObject("Point") pointObj.X = pntDict[pnt][0] pointObj.Y = pntDict[pnt][1] insertRow.setValue(shapeFieldName, pointObj) insertRows.insertRow(insertRow) del pointObj, insertRow, insertRows
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.