help reprojshp

Title

reprojshp -- Reproject Shapefiles to specified coordinate systems

Syntax

reprojshp shpfile [, options]

Description

reprojshp reprojects shapefiles to a specified coordinate reference system (CRS). The target CRS can be specified using an EPSG code, by referencing a GeoTIFF file, or by referencing a Shapefile that contains the desired CRS information.

The reprojected shapefile is saved as a new file (shpfile_reproj.shp), preserving the original file.

Options

crs(crs_or_file) is required and specifies the target coordinate system. The shapefile can be reprojected to:

• EPSG code: For example, crs(EPSG:4326) or crs(4326) (EPSG: prefix is automatically added).

• GeoTIFF file path: For example, crs("C:/data/raster.tif"), automatically reads the coordinate system from .tif/.tiff files.

• Shapefile path: For example, crs("C:/data/reference.shp"), automatically reads the coordinate system from the .prj file of the specified shapefile.

Examples

Reproject shapefile to WGS84 (EPSG:4326):

. reprojshp "fuzhou.shp", crs(EPSG:4326)

Reproject shapefile using GeoTIFF file as reference:

. reprojshp "fuzhou.shp", crs("DMSP-like2020.tif")

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, etc.) must be in the same directory as the main file

Technical Details

The command uses GeoTools library for coordinate reference system transformations. It automatically handles datum transformations and coordinate system conversions. When reprojecting geographic coordinate systems to projected coordinate systems, appropriate UTM zones or other suitable projections are selected automatically for accurate area calculations.

Author

Chunxia Chen

School of Management, Xiamen University

Email: triciachen6754@126.com

Also see

Online: checkshp, intershp, areashp