ランダム ポイントの作成(Create Random Points) (データの管理)

サマリ

指定された数のランダム ポイント フィーチャを作成します。ランダム ポイントは、一定の制限範囲内、ポリゴン フィーチャ内、ポイント フィーチャ上、またはライン フィーチャ上に生成することができます。

[ランダム ポイントの作成(Create Random Points)] ツールの仕組みの詳細

使用法

構文

CreateRandomPoints_management (out_path, out_name, {constraining_feature_class}, {constraining_extent}, {number_of_points_or_field}, {minimum_allowed_distance}, {create_multipoint_output}, {multipoint_size})
パラメータ説明データ タイプ
out_path

ランダム ポイント フィーチャクラスが作成される場所またはワークスペース。この場所またはワークスペースはすでに存在している必要があります。

Feature Dataset;Workspace
out_name

作成するランダム ポイント フィーチャクラスの名前。

String
constraining_feature_class
(オプション)

ランダム ポイントは、このフィーチャクラスのフィーチャ内またはフィーチャ上に生成されます。制限フィーチャクラスは、ポイント、マルチポイント、ライン、またはポリゴンのいずれかです。ポイントは、ポリゴン フィーチャ内、ライン フィーチャ上、またはポイント フィーチャの場所でランダムに配置されます。フィーチャクラスに含まれる各フィーチャ内には、指定された数のポイントが生成されます(たとえば、100 ポイントを指定したときに、制限フィーチャクラスに 5 つのフィーチャがある場合、各フィーチャに 100 のランダム ポイントが生成され、合計で 500 のポイントが生成されます)。

Feature Layer
constraining_extent
(オプション)

ランダム ポイントは、範囲内に生成されます。制限範囲は、制限フィーチャクラスが指定されていない場合にのみ使用されます。

Extent;Feature Layer;Raster Layer
number_of_points_or_field
(オプション)

ランダムの生成されるポイントの数。

これには、long integer タイプの数値を指定することも、各フィーチャ内に配置するランダム ポイントの数を示す数値を含んでいる制限フィーチャからのフィールドを指定することもできます。このフィールドのオプションは、ポリゴンまたはライン制限フィーチャに対してのみ有効です。ポイントの数が long integer タイプの数値を使用して指定されている場合、制限フィーチャクラスの各フィーチャ内または各フィーチャ上には、その数のランダム ポイントが生成されます。

Field;Long
minimum_allowed_distance
(オプション)

2 つのランダムに配置されたポイントの間の最小距離。値として「1 Meter」を指定すると、すべてのランダム ポイントの最も近いポイントまでの距離が 1 メートル以上になります。

Field;Linear unit
create_multipoint_output
(オプション)

出力フィーチャクラスがマルチパート フィーチャになるかシングル パート フィーチャになるかを決定します。

  • POINT出力はポイント ジオメトリ タイプになります(各ポイントは個別のフィーチャ)。これがデフォルトです。
  • MULTIPOINT出力はマルチポイント ジオメトリ タイプになります(すべてのポイントが 1 つのフィーチャ)。
Boolean
multipoint_size
(オプション)

[マルチポイント出力フィーチャを作成] オプションが使用されている(オン/MULTIPOINT)場合、このパラメータは各マルチポイント ジオメトリに配置されるランダム ポイントの数を指定します。

Long

コードのサンプル

Create Random Points(ランダム ポイントの作成)の例(Python ウィンドウ)

次の Python ウィンドウ スクリプトは、Create Random Points(ランダム ポイントの作成)ツールをイミディエイト モードで使用する方法を示しています。

import arcpy
arcpy.CreateRandomPoints_management("c:/data/project", "samplepoints", "c:/data/studyarea.shp", "", 500, "", "POINT", "")
ランダム値を使用した Create Random Points(ランダム ポイントの作成)の例(スタンドアロン Python スクリプト)

次のスタンドアロン Python スクリプトは、ランダム値でランダム ポイントを作成する方法を示しています。

#Name: RandomPointsRandomValues.py
#Purpose: create random points with random values
#Author: ESRI

# Import system modules
import arcpy, os, random
from arcpy import env

# Create random points in the features of a constraining feature class
# Number of points for each feature determined by the value in the field specified
outGDB = "C:/data/county.gdb"
outName = "randpeople"
conFC = "C:/data/county.gdb/blocks"
numField = "POP2000"
arcpy.CreateRandomPoints_management(outGDB, outName, conFC, "", numField)

# set workspace
env.workspace = "C:/data/county.gdb"

# Create fields for random values
fieldInt = "fieldInt"
fieldFlt = "fieldFlt"
arcpy.AddField_management(outName, fieldInt, "LONG") # add long integer field
arcpy.AddField_management(outName, fieldFlt, "FLOAT") # add float field

# Calculate random values between 1-100 in the new fields
arcpy.CalculateField_management(outName, fieldInt, "random.randint(1,100)","PYTHON","import random")
arcpy.CalculateField_management(outName, fieldFlt, "random.uniform(1,100)","PYTHON","import random")
Create Random Points(ランダム ポイントの作成)の例(スタンドアロン Python スクリプト)

次のスタンドアロン Python スクリプトは、Create Random Points(ランダム ポイントの作成)ツールのいくつかの使用方法を示しています。

#Name: RandomPoints.py
#Purpose: create several types of random points feature classes
#Author: ESRI

# Import system modules
import arcpy, os
from arcpy import env

#set environment settings
env.overWriteOutput = True

# Create random points in an extent defined simply by numbers
outFolder = "C:/data"
numExtent = "0 0 1000 1000"
numPoints = 100
outName = "myRandPnts.shp"
env.outputCoordinateSystem = "Coordinate Systems/Projected Coordinate Systems/World/Miller Cylindrical (world).prj"
arcpy.CreateRandomPoints_management(outFolder, outName, "", numExtent, numPoints)
env.outputCoordinateSystem = ""
 
# Create random points in an extent defined by another feature class
outName = "testpoints.shp"
fcExtent = "C:/data/studyarea.shp"
arcpy.CreateRandomPoints_management(outFolder, outName, "", fcExtent, numPoints)
 
# Create random points in the features of a constraining feature class
# Number of points for each feature determined by the value in the field specified
outGDB = "C:/data/county.gdb"
outName = "randpeople"
conFC = "C:/data/county.gdb/blocks"
numField = "POP2000"
arcpy.CreateRandomPoints_management(outGDB, outName, conFC, "", numField)

#create random points in the features of a constraining 
#feature class with a minimum allowed distance
outName = "constparcelpnts"
conFC = "C:/data/county.gdb/parcels"
numPoints = 10
minDistance = "5 Feet"
arcpy.CreateRandomPoints_management(outGDB, outName, conFC, "", numPoints, minDistance) 

#Creat random points with a multipoint output
outName = "randomMPs"
fcExtent = "C:/data/county.gdb/county"
numPoints = 100
numMP = 10
arcpy.CreateRandomPoints_management(outGDB, outName, "", fcExtent, numPoints, "", "MULTIPOINT", numMP)

環境

関連項目

ライセンス情報

ArcView: 必須 Spatial Analyst または 3D Analyst
ArcEditor: 必須 Spatial Analyst または 3D Analyst
ArcInfo: はい

7/10/2012