Label | Explanation | Data Type |
Input Raster or Feature Class Data | The data source that labels the training samples. | Mosaic Layer; Raster Layer; Feature Layer; Image Service; String |
Output Training Sample Feature Class |
The output training sample feature class in the format that can be used in training tools, including shapefiles. The output feature class can be either a polygon feature class or a point feature class. | Feature Class |
Min Sample Area (Optional) | The minimum area needed for each training sample, in square meters. The minimum value must be greater than or equal to 0. | Double |
Max Sample Radius (Optional) | The longest distance (in meters) from any point within the training sample to its center seed point. If set to 0, the output training sample will be points instead of polygons. The minimum value must be greater than or equal to 0. | Double |
Available with Spatial Analyst license.
Summary
Generates training samples from seed points, such as accuracy assessment points or training sample points. A typical use case is generating training samples from an existing source, such as a thematic raster or a feature class.
Usage
This tool accepts third party data sources into the ArcGIS classification toolset. Inputs that identify the class schema to guide the generation of training samples includes thematic raster data sets, or polygons such as previous classification maps, building footprints, roads, or other GIS data.
For raster inputs, the tool will perform a region grow from seed points, under the condition that all pixels have the same value. Region grow is controlled by Max Sample Radius (in Python it is max_radius). Best practices in remote sensing suggest training samples should be homogeneous within the training sample, and the size of the sample should be representative of the target feature. If region grow from certain seed points cannot reach an area larger than Min Sample Area (in Python it is min_area), the seed point is not used.
For feature class inputs, the tool will select features from input data that intersect the point feature class, instead of using region grow.
You can use the Create Accuracy Assessment Points tool for generating the training sample points. It presents options for the number of points to use and a few sampling strategies for generating the random points.
If you already have training sample seed points or a way to generate them, these can be easily used since the tool only uses the x and y coordinates of a point feature class file, not the associated table.
Parameters
GenerateTrainingSamplesFromSeedPoints(in_class_data, out_training_feature_class, {min_sample_area}, {max_sample_radius})
Name | Explanation | Data Type |
in_class_data | The data source that labels the training samples. | Mosaic Layer; Raster Layer; Feature Layer; Image Service; String |
out_training_feature_class |
The output training sample feature class in the format that can be used in training tools, including shapefiles. The output feature class can be either a polygon feature class or a point feature class. | Feature Class |
min_sample_area (Optional) | The minimum area needed for each training sample, in square meters. The minimum value must be greater than or equal to 0. | Double |
max_sample_radius (Optional) | The longest distance (in meters) from any point within the training sample to its center seed point. If set to 0, the output training sample will be points instead of polygons. The minimum value must be greater than or equal to 0. | Double |
Code sample
Create training samples from seed points.
import arcpy
from arcpy.ia import *
# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")
GenerateTrainingSamplesFromSeedPoints("c:/test/amberg_3band_classified_ISO.tif",
"c:/input/seed_points",
"c:/test/out/training_samples.gdb\out_training_sample",
30, 50)
Create training samples from seed points.
# Import system modules
import arcpy
from arcpy.ia import *
# Set local variables
inclassified_raster = "c:/test/landuse.tif"
in_seed_points = "c:/test/seed_points.shp"
output_trainingsamples = "c:/test/output/training.gdb/trainingsmaples"
maxSampleArea = 30
minSampleRadius = 50
# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")
#Execute
GenerateTrainingSamplesFromSeedPoints(inclassified_raster, in_seed_points,
output_trainingiamples, maxiampleArea, miniampleRadius)