Helper¶
feature¶
-
turf.
feature
(geom: (typing.Dict, <class 'turf.helpers._features.Point'>, <class 'turf.helpers._features.LineString'>, <class 'turf.helpers._features.Polygon'>, <class 'turf.helpers._features.MultiPoint'>, <class 'turf.helpers._features.MultiLineString'>, <class 'turf.helpers._features.MultiPolygon'>), properties: Dict = None, options: Dict = None, as_geojson: bool = True) → Union[turf.helpers._features.Feature, Dict][source]¶ Wraps a GeoJSON Geometry in a GeoJSON Feature.
- Parameters
geom – input geometry
properties – a dictionary of key-value pairs to add as properties
options – an options dictionary: [options[“bbox”] Bounding Box Array [west, south, east, north] associated with the Feature [options[“id”] Identifier associated with the Feature
as_geojson – whether the return value should be a geojson
- Returns
a GeoJSON feature
feature-collection¶
-
turf.
feature_collection
(features: Sequence, options: Dict = None, as_geojson: bool = True) → Union[turf.helpers._features.FeatureCollection, Dict][source]¶ Takes one or more Feature and creates a FeatureCollection.
- Parameters
features – input features
options – an options dictionary: [options[“bbox”] Bounding Box Array [west, south, east, north] associated with the Feature [options[“id”] Identifier associated with the Feature
as_geojson – whether the return value should be a geojson
- Returns
a FeatureCollection of Features
geometry¶
-
turf.
geometry
(geom_type: str, coordinates: Sequence, as_geojson: bool = True) → Union[Dict, turf.helpers._features.Point, turf.helpers._features.LineString, turf.helpers._features.Polygon, turf.helpers._features.MultiPoint, turf.helpers._features.MultiLineString, turf.helpers._features.MultiPolygon][source]¶ Creates a GeoJSON {@link Geometry} from a Geometry string type & coordinates. For GeometryCollection type use helpers.geometryCollection
- Parameters
geom_type – one of “Point” | “LineString” | “Polygon” | “MultiPoint” | “MultiLineString” | “MultiPolygon”
coordinates – array of coordinates [lng, lat]
as_geojson – whether the return value should be a geojson
- Returns
a GeoJSON geometry
line-string¶
-
turf.
line_string
(coordinates: Sequence, properties: Dict = None, options: Dict = None, as_geojson: bool = True) → Union[turf.helpers._features.LineString, Dict][source]¶ Creates a LineString Feature from an Array of Positions.
- Parameters
coordinates – a list of Positions - Position[]
properties – a dictionary of key-value pairs to add as properties
options – an options dictionary: [options[“bbox”] Bounding Box Array [west, south, east, north] associated with the Feature [options[“id”] Identifier associated with the Feature
as_geojson – whether the return value should be a geojson
- Returns
a LineString feature
line-strings¶
-
turf.
line_strings
(coordinates: Sequence, properties: Dict = None, options: Dict = None, as_geojson: bool = True) → Union[turf.helpers._features.FeatureCollection, Dict][source]¶ Creates a LineString FeatureCollection from an Array of LineString coordinates.
- Parameters
coordinates – a list of a list of Positions - Position[][]
properties – a dictionary of key-value pairs to add as properties
options – an options dictionary: [options[“bbox”] Bounding Box Array [west, south, east, north] associated with the Feature [options[“id”] Identifier associated with the Feature
as_geojson – whether the return value should be a geojson
- Returns
LineString FeatureCollection
multi-line-string¶
-
turf.
multi_line_string
(coordinates: Sequence, properties: Dict = None, options: Dict = None, as_geojson: bool = True) → Union[turf.helpers._features.MultiLineString, Dict][source]¶ Creates a MultiLineString Feature based on a coordinate array. Properties can be added optionally.
- Parameters
coordinates – a list of a list of Positions - Position[][]
properties – a dictionary of key-value pairs to add as properties
options – an options dictionary: [options[“bbox”] Bounding Box Array [west, south, east, north] associated with the Feature [options[“id”] Identifier associated with the Feature
as_geojson – whether the return value should be a geojson
- Returns
a MultiLineString feature
point¶
-
turf.
point
(coordinates: Sequence, properties: Dict = None, options: Dict = None, as_geojson: bool = True) → Union[turf.helpers._features.Point, Dict][source]¶ Creates a Point Feature from a Position.
- Parameters
coordinates – coordinates longitude, latitude position in degrees - Position
properties – a dictionary of key-value pairs to add as properties
options – an options dictionary: [options[“bbox”] Bounding Box Array [west, south, east, north] associated with the Feature [options[“id”] Identifier associated with the Feature
as_geojson – whether the return value should be a geojson
- Returns
a Point Feature
points¶
-
turf.
points
(coordinates: Sequence, properties: Dict = None, options: Dict = None, as_geojson: bool = True) → Union[turf.helpers._features.FeatureCollection, Dict][source]¶ Creates a Point FeatureCollection from an Array of Point coordinates.
- Parameters
coordinates – a list of Points - Position[]
properties – a dictionary of key-value pairs to add as properties
options – an options dictionary: [options[“bbox”] Bounding Box Array [west, south, east, north] associated with the Feature [options[“id”] Identifier associated with the Feature
as_geojson – whether the return value should be a geojson
- Returns
Point FeatureCollection
multi-point¶
-
turf.
multi_point
(coordinates: Sequence, properties: Dict = None, options: Dict = None, as_geojson: bool = True) → Union[turf.helpers._features.MultiPoint, Dict][source]¶ Creates a MultiPoint Feature based on a coordinate array. Properties can be added optionally.
- Parameters
coordinates – a list of Points - Position[]
properties – a dictionary of key-value pairs to add as properties
options – an options dictionary: [options[“bbox”] Bounding Box Array [west, south, east, north] associated with the Feature [options[“id”] Identifier associated with the Feature
as_geojson – whether the return value should be a geojson
- Returns
a MultiPoint feature
polygon¶
-
turf.
polygon
(coordinates: Sequence, properties: Dict = None, options: Dict = None, as_geojson: bool = True) → Union[turf.helpers._features.Polygon, Dict][source]¶ Creates a Polygon Feature from an Array of LinearRings.
- Parameters
coordinates – a list of a list of Positions - Position[][]
properties – a dictionary of key-value pairs to add as properties
options – an options dictionary: [options[“bbox”] Bounding Box Array [west, south, east, north] associated with the Feature [options[“id”] Identifier associated with the Feature
as_geojson – whether the return value should be a geojson
- Returns
a Polygon Feature
polygons¶
-
turf.
polygons
(coordinates: Sequence, properties: Dict = None, options: Dict = None, as_geojson: bool = True) → Union[turf.helpers._features.FeatureCollection, Dict][source]¶ Creates a Polygon FeatureCollection from an Array of Polygon coordinates.
- Parameters
coordinates – an array of polygons - Position[][][]
properties – a dictionary of key-value pairs to add as properties
options – an options dictionary: [options[“bbox”] Bounding Box Array [west, south, east, north] associated with the Feature [options[“id”] Identifier associated with the Feature
as_geojson – whether the return value should be a geojson
- Returns
Polygon FeatureCollection
multi-polygon¶
-
turf.
multi_polygon
(coordinates: Sequence, properties: Dict = None, options: Dict = None, as_geojson: bool = True) → Union[turf.helpers._features.MultiPolygon, Dict][source]¶ Creates a MultiPolygon Feature based on a coordinate array. Properties can be added optionally.
- Parameters
coordinates – an array of polygons - Position[][][]
properties – a dictionary of key-value pairs to add as properties
options – an options dictionary: [options[“bbox”] Bounding Box Array [west, south, east, north] associated with the Feature [options[“id”] Identifier associated with the Feature
as_geojson – whether the return value should be a geojson
- Returns
a MultiPolygon feature