help checkshp

Title

checkshp -- Geometric validation and cleaning of Shapefiles

Syntax

checkshp shpfile [, options]

options

detail Detailed output mode, containing detailed information for each invalid feature

summary Summary output mode, showing only statistical information (default)

clean Remove invalid geometric features and save to a new file

Note: Options detail and summary are mutually exclusive.

Description

checkshp validates the geometric validity of shapefiles and detects invalid geometric features. It can generate detailed or summary reports, and optionally clean invalid features by removing them and saving the cleaned shapefile to a new file.

The command checks for common geometric errors such as self-intersections, duplicate vertices, invalid rings, and other topology issues that may cause problems in spatial analysis or visualization.

Examples

Check shapefile with summary output (default):

. checkshp "fuzhou.shp"

Check and clean invalid features:

. checkshp "fuzhou.shp", detail clean

Requirements

Runtime environment requirements:

• Java 17 or higher (automatically detected from Stata's Java configuration or system PATH)

• checkshp-0.1.0.jar file (JAR package needs to be built first; automatically searched in current directory, build/libs, or Stata's ado directory)

• All auxiliary files of the Shapefile (.shx, .dbf, .prj) must be in the same directory as the main file

Technical Details

The command uses JTS (Java Topology Suite) and GeoTools libraries to validate geometry. It performs comprehensive checks on all features in the shapefile and reports any topology errors found. When clean is specified, invalid features are automatically removed using geometry fixing algorithms.

Author

Chunxia Chen

School of Management, Xiamen University

Email: triciachen6754@126.com

Also see

Online: intershp, reprojshp, areashp