ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Generate Training Samples From Seed Points

Available with Spatial Analyst license.

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

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.

Syntax

GenerateTrainingSamplesFromSeedPoints(in_class_data, in_seed_points, out_training_feature_class, {min_sample_area}, {max_sample_radius})
ParameterExplanationData Type
in_class_data

The data source that labels the training samples.

Mosaic Layer; Raster Layer; Feature Layer; Image Service; String
in_seed_points

A point shapefile or feature class to provide the centers of training sample polygons.

Feature Layer; Raster Catalog Layer
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

GenerateTrainingSamplesFromSeedPoints example 1 (Python window)

Create training samples from seed points.

### GenerateTrainingSamplesFromSeedPoints example 1 (Python window)
import arcpy
from arcpy.sa import *

cls_img = "C:/Data/svm.tif"
seed_pnts = "C:/Data/seeds.shp"
trn_samples = "C:/out/ts.shp"

GenerateTrainingSamplesFromSeedPoints(cls_img, seed_pnts, trn_samples, "30", "50")
GenerateTrainingSamplesFromSeedPoints example 2 (stand-alone script)

Create training samples from seed points.

### GenerateTrainingSamplesFromSeedPoints example 2 (stand-alone script)
import arcpy
from arcpy.sa import *

GenerateTrainingSamplesFromSeedPoints("C:/Data/svm.tif", 
                                      "C:/Data/seeds.shp", 
                                      "C:/out/ts.shp", 
                                      "30", "50")

Environments

  • Current Workspace
  • Extent
  • Scratch Workspace

Licensing information

  • Basic: Requires Spatial Analyst
  • Standard: Requires Spatial Analyst
  • Advanced: Requires Spatial Analyst

Related topics

  • An overview of the Segmentation and Classification toolset
  • What is image classification?
  • Train Maximum Likelihood Classifier
  • Train Random Trees Classifier
  • Train Support Vector Machine Classifier
  • Classify Raster
  • Inspect Training Samples

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal