示例#1
0
#
outPnts = []
for i in range(numShapes):
    if circCent == "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)
    #
    # generate the points
    if theType == "Random":
        pnts = PM.circle_on(n, Xcent, Ycent, radius, "True")  # random on
    elif theType == "Within":
        pnts = PM.circle_in(n, Xcent, Ycent, radius)  # random within
    else:
        pnts = PM.circle_on(n, Xcent, Ycent, radius, "False")  # sequential on
    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)
示例#2
0
#
outPnts = []
for i in range(numShapes):
    if (circCent == "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)
    #
    #generate the points
    if theType == "Random":
        pnts = PM.circle_on(n, Xcent, Ycent, radius, "True")  #random on
    elif theType == "Within":
        pnts = PM.circle_in(n, Xcent, Ycent, radius)  #random within
    else:
        pnts = PM.circle_on(n, Xcent, Ycent, radius, "False")  #sequential on
    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)