コード例 #1
0
outPnts = []
for i in range(numShapes):
  if (ellCent == "random"):
    if numShapes > 1: 
      Xcent = random.uniform(L,R); Ycent = random.uniform(B,T)
    else:
      Xcent = L + ((R-L)/2.0); Ycent = B + ((T-B)/2.0)
      arcpy.AddMessage("\n" + " centers(s) at... " + str(Xcent)+ " " + str(Ycent))
  if (ellAngle == "random"):
    theta = random.uniform(-180.0, 180.0)
  #
  #generate the points
  #
  arcpy.AddMessage("type " + str(theType))
  if theType == "Ellipse_annulus":
    pnts = PM.ellipse_annulus(n, Xcent, Ycent, theta, major, minor, major2)
  else:
    pnts = PM.ellipse_oval(n, Xcent, Ycent, theta, major, minor, major2)
  outPnts.append(pnts)
#
#optional shapefile creation
if outFC != "#":
  fieldsToAdd = [["Group", "LONG", "9", "#"],
                 ["X", "DOUBLE", 16, 7],
                 ["Y", "DOUBLE", 16, 7]]
  py_gp.createPointFile (outFC, shapeClass, "#", outPnts, fieldsToAdd, arcpy)
  arcpy.AddMessage("\n" + "You can join the original table to " \
                + "this shapefile table if you want other attributes." + "\n")
#
#optional csv file creation or output to screen
if outCSV != "#":
コード例 #2
0
        if numShapes > 1:
            Xcent = random.uniform(L, R)
            Ycent = random.uniform(B, T)
        else:
            Xcent = L + ((R - L) / 2.0)
            Ycent = B + ((T - B) / 2.0)
            arcpy.AddMessage("\n" + " centers(s) at... " + str(Xcent) + " " +
                             str(Ycent))
    if (ellAngle == "random"):
        theta = random.uniform(-180.0, 180.0)
    #
    #generate the points
    #
    arcpy.AddMessage("type " + str(theType))
    if theType == "Ellipse_annulus":
        pnts = PM.ellipse_annulus(n, Xcent, Ycent, theta, major, minor, major2)
    else:
        pnts = PM.ellipse_oval(n, Xcent, Ycent, theta, major, minor, major2)
    outPnts.append(pnts)
#
#optional shapefile creation
if outFC != "#":
    fieldsToAdd = [["Group", "LONG", "9", "#"], ["X", "DOUBLE", 16, 7],
                   ["Y", "DOUBLE", 16, 7]]
    py_gp.createPointFile(outFC, shapeClass, "#", outPnts, fieldsToAdd, arcpy)
    arcpy.AddMessage("\n" + "You can join the original table to " \
                  + "this shapefile table if you want other attributes." + "\n")
#
#optional csv file creation or output to screen
if outCSV != "#":
    PM.to_CSV(outCSV, outPnts)