Skip to content

Reference

ShapelyGeoJsonFeature

A class to represent a GeoJSON feature with Shapely geometries.

Parameters:

Name Type Description Default
geometry_list list[Point | LineString | Polygon]

A list of Shapely geometry objects (Point, LineString, or Polygon).

required
properties dict | None

A dictionary of properties associated with the feature. Default is None.

None

geometry_list: list[Point | LineString | Polygon] property

Get the list of geometries.

Returns:

Type Description
list[Point | LineString | Polygon]

list[Point | LineString | Polygon]: The list of Shapely geometries.

properties: dict property writable

Get the properties of the feature.

Returns:

Name Type Description
dict dict

The properties associated with the feature.

as_feature()

Convert the ShapelyGeoJsonFeature to a GeoJSON feature.

Returns:

Type Description
Feature

The corresponding GeoJSON feature representation.

CrsEnum

Bases: Enum

Enumeration of Coordinate Reference Systems (CRS) with their corresponding EPSG codes.

WGS84 = '4326' class-attribute instance-attribute

World Geodetic System 1984 (WGS 84) - EPSG:4326.

RD_NEW = '28992' class-attribute instance-attribute

Amersfoort / RD New (Rijksdriehoeksstelsel) - EPSG:28992.

RD_NEW_NAP = '7415' class-attribute instance-attribute

Amersfoort / RD New (Rijksdriehoeksstelsel) + NAP (Normaal Amsterdams Peil) - EPSG:7415.

ShapelyGeoJsonFeatureCollection

Shapley GeoJson FeatureCollection stores geojson Features.

Parameters:

Name Type Description Default
features list[ShapelyGeoJsonFeature]

List of GeoJsonFeatures or BaseGeometry objects.

required
crs CrsEnum | None

Optional CRS that will be included in the geojson.

None

geojson_str()

Generate a GeoJSON string representation of the FeatureCollection.

Returns:

Type Description
str

A string containing the GeoJSON representation of the FeatureCollection.

to_geojson_file(file_path)

Write the FeatureCollection to a GeoJSON file.

Parameters:

Name Type Description Default
file_path str | Path

The path where the GeoJSON file will be saved.

required

FeatureCollection

Bases: FeatureCollection

Custom FeatureCollection that adds a crs string (old geojson spec).