Skip to content

read_shapefile builtin

read_shapefile(path, *, nodata=None, length_unit=None)

Reads a shapefile as a PointSet or Polylines.

Parameters:

Name Type Description Default
path str or Path

The .shp file; the .dbf beside it holds the attributes and an optional .prj the CRS.

required
nodata sequence of float or str

Values read as null, as in read_csv; blank fields are always null.

None

Returns:

Type Description
PointSet or Polylines

Point files give one point per shape, and one per member of a multipoint, which repeats its row. Line files give open parts, polygon files closed parts without the repeated closing vertex; a null shape is a feature without parts. 2D shapes get z = 0, M values are dropped. Numeric fields are float64, logical fields bool, the rest text. The .prj text is the CRS.

used in