API_HELPER_METHODS_GEOMETRIC_OPERATIONS

API_HELPER_METHODS_GEOMETRIC_OPERATIONS

Source:

Methods

(static) exports.area(geoJSON) → {number}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#area to compute the area of the submitted features in square meters (m²).

Parameters:
Name Type Description
geoJSON GeoJSON

any form of valid GeoJSON object (e.g. a single feature, or a FeatureCollection) with polygonal geometries.

Returns:

the area of the submitted features in square meters (m²)

Type
number

(static) exports.area_feature_asProperty(feature) → {Feature.<Polygon>}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#area to compute the area of the submitted feature in square meters (m²) and append it as new property area_squareMeters.

Parameters:
Name Type Description
feature Feature.<Polygon>

A single GeoJSON feature with polygonal geometry.

Returns:

the GeoJSON feature containing its computed area in square meters (m²) within new property area_squareMeters.

Type
Feature.<Polygon>

(static) exports.area_featureCollection_asProperty(featureCollection_geoJSON) → {FeatureCollection.<Polygon>}

Source:
See:
  • turf CONSTANT
  • area_feature_asProperty

Computes the area in square meters (m²) of each feature of the submitted featureCollection_geoJSON as new property area_squareMeters.

Parameters:
Name Type Description
featureCollection_geoJSON FeatureCollection.<Polygon>

A GeoJSON FeatureCollection with polygonal geometries.

Returns:

the GeoJSON FeatureCollection containing the computed area of each feature in square meters (m²) within new property area_squareMeters of each feature.

Type
FeatureCollection.<Polygon>

(static) exports.bbox_feature(feature) → {Feature}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#bbox and https://turfjs.org/docs/#bboxPolygon to compute the bounding box of a single feature.

Parameters:
Name Type Description
feature Feature

a single GeoJSON feature consisting of geometry and properties, for whom the bounding box shall be computed

Returns:

the GeoJSON feature whose geometry has been replaced by the bounding box geometry of type Polygon. The resulting feature contains all properties of the original feature

Type
Feature

(static) exports.bbox_featureCollection(featureCollection_geoJSON) → {FeatureCollection.<Polygon>}

Source:
See:
  • turf CONSTANT
  • bbox_feature

Computes the bounding boxes of all features of the submitted featureCollection_geoJSON.

Parameters:
Name Type Description
featureCollection_geoJSON FeatureCollection.<Polygon>

a GeoJSON FeatureCollection consisting of multiple features, for whom the bounding box shall be computed

Returns:

the GeoJSON features whose geometry has been replaced by the bounding box geometry of type Polygon as GeoJSON FeatureCollection. The resulting features contain all properties of the original features.

Type
FeatureCollection.<Polygon>

(static) exports.buffer_feature(feature, radiusInMeters) → {Feature.<Polygon>}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#buffer to compute the buffered geometry a single feature.

Parameters:
Name Type Description
feature Feature

a single GeoJSON feature consisting of geometry and properties, for whom the buffer shall be computed

radiusInMeters number

the buffer radius in meters

Returns:

the GeoJSON feature whose geometry has been replaced by the buffered geometry of type Polygon. The resulting feature contains all properties of the original feature

Type
Feature.<Polygon>

(static) exports.buffer_featureCollection(featureCollection_geoJSON, radiusInMeters) → {FeatureCollection.<Polygon>}

Source:
See:
  • turf CONSTANT
  • buffer_feature

Computes the buffered geometries of all features of the submitted featureCollection_geoJSON.

Parameters:
Name Type Description
featureCollection_geoJSON FeatureCollection

a GeoJSON FeatureCollection consisting of multiple features, for whom the buffers shall be computed

radiusInMeters number

the buffer radius in meters

Returns:

the GeoJSON features whose geometry has been replaced by the buffered geometry of type Polygon as GeoJSON FeatureCollection. The resulting features contain all properties of the original features.

Type
FeatureCollection.<Polygon>

(static) exports.center_geometric(geoJSON) → {Feature.<Point>}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#center to compute the geometric center point the submitted features.

Parameters:
Name Type Description
geoJSON GeoJSON

any form of valid GeoJSON object (e.g. a single feature, or a FeatureCollection).

Returns:

the GeoJSON point feature representing the absolute geometric center of the submitted features.

Type
Feature.<Point>

(static) exports.center_mass(geoJSON, properties) → {Feature.<Point>}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#centerOfMass to compute the center of mass of the submitted features.

Parameters:
Name Type Description
geoJSON GeoJSON

any form of valid GeoJSON object (e.g. a single feature, or a FeatureCollection).

properties Object

the properties object that shall be used to set the point feature's properties.

Returns:

the GeoJSON point feature representing the center of mass of the submitted features (using the mean of all vertices).

Type
Feature.<Point>

(static) exports.centroid(geoJSON) → {Feature.<Point>}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#center to compute the centroid the submitted features.

Parameters:
Name Type Description
geoJSON GeoJSON

any form of valid GeoJSON object (e.g. a single feature, or a FeatureCollection).

Returns:

the GeoJSON point feature representing the centroid of the submitted features.

Type
Feature.<Point>

(static) exports.contains(feature_A, feature_B) → {boolean}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#booleanContains to check if the submitted GeoJSON feature feature_A contains feature_B.

Parameters:
Name Type Description
feature_A Feature

a GeoJSON feature of any type

feature_B Feature

a GeoJSON feature of any type

Returns:

returns true, if feature_A contains feature_B.

Type
boolean

(static) exports.difference(polygonFeature_A, polygonFeature_B) → {Feature.<(Polygon|MultiPolygon)>|null}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#difference to compute the difference between two polygonal GeoJSON features.

Parameters:
Name Type Description
polygonFeature_A Feature.<Polygon>

a GeoJSON feature of type Polygon

polygonFeature_B Feature.<Polygon>

a GeoJSON feature of type Polygon to difference from polygonFeature_A

Returns:

the GeoJSON feature of type MultiPolygon showing the area of polygonFeature_A excluding the area of polygonFeature_B (if empty returns null).

Type
Feature.<(Polygon|MultiPolygon)> | null

(static) exports.disjoint(feature_A, feature_B) → {boolean}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#booleanDisjoint to check if the submitted GeoJSON features are disjoint.

Parameters:
Name Type Description
feature_A Feature

a GeoJSON feature of any type

feature_B Feature

a GeoJSON feature of any type

Returns:

returns true, if both features are disjoint and thus do not intersect.

Type
boolean

(static) exports.dissolve(featureCollection_geoJSON, propertyName) → {FeatureCollection.<Polygon>}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#dissolve to dissolve polygonal features. NOTE: TURF DISSOLVE IS KNOWN TO BE BUGGY: IT MIGHT FAIL WITH ERROR ALTHOUGH IT SHOULD WORK. AS AN ALTERNATIVE, YOU SHOULD CONSIDER TO USE union METHOD.

Parameters:
Name Type Description
featureCollection_geoJSON FeatureCollection.<Polygon>

valid GeoJSON FeatureCollection with polygonal geometries (MultiPolygons will be transformed to multiple polygons before dissolving).

propertyName string

OPTIONAL parameter that points to an existing attribute used by the features. If set, only features with the same attribute value will be dissolved.

Returns:

the GeoJSON FeatureCollection containing the dissolved features (Note that attributes are not merged/aggregated).

Type
FeatureCollection.<Polygon>

(static) exports.distance_direct_kilometers(point_A, point_B) → {number}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#distance to compute the direct (aerial) distance between the submitted points.

Parameters:
Name Type Description
point_A Feature.<Point>

valid GeoJSON Feature with geometry type Point

point_B Feature.<Point>

valid GeoJSON Feature with geometry type Point

Returns:

the direct distance between the submitted points in kilometers.

Type
number

(async, static) exports.distance_matrix_kilometers(locations, sourceIndices, destinationIndices, vehicleType) → {object}

Source:
See:
  • openrouteservice_url CONSTANT

Performs a POST request against /matrix endpoint of the openrouteservice instance specified via the CONSTANT openrouteservice_url (version 4.7.2) to aquire the distance matrix for the submitted source and destinations points based on waypath routing.

Example
// examplar response to show how distance matrix is structured
{
    "distances": [
        [
            2.59,
            4.55
        ],
        [
            2.05,
            2.6
        ]
    ]
    "destinations": [
        {
            "location": [
                7.019859,
                51.458106
            ],
            "name": "Severinstraße",
            "snapped_distance": 24.9
        },
        {
            "location": [
                7.032748,
                51.445316
            ],
            "name": "",
            "snapped_distance": 12.44
        }
    ],
    "sources": [
        {
            "location": [
                7.007574,
                51.475965
            ],
            "name": "Gladbecker Straße, B 224",
            "snapped_distance": 0.35
        },
        {
            "location": [
                7.001853,
                51.449557
            ],
            "name": "",
            "snapped_distance": 1.98
        }
    ],
    "info": {
        "service": "matrix",
        "engine": {
            "version": "4.7.2",
            "build_date": "2019-03-29T11:38:45Z"
        },
        "attribution": "openrouteservice.org, OpenStreetMap contributors",
        "timestamp": 1560748456760,
        "query": {
            "profile": "foot-walking",
            "units": "km"
        }
    }
}
Parameters:
Name Type Description
locations Array.Feature.<Point>

array of valid GeoJSON Features with geometry type Point - the coordinates are expected to follow the order latitude. WARNING: it might be possible, that the queried instance of OpenRouteService has a configuration for maximum number of allowed locations per request (i.e. 200 is default configuration), causing the request to fail.

sourceIndices String

the indices pointing to such points within submitted locations, that shall be used as source points for matrix analysis, as comma-separated string of indices. Required format: 'index1,index2,index3,...'. A check, whether the index string contains indices that do not match the locations array, is not performed.

destinationIndices String

the indices pointing to such points within submitted locations, that shall be used as destination points for matrix analysis, as comma-separated string of indices. Required format: 'index4,index5,index6,...'. A check, whether the index string contains indices that do not match the locations array, is not performed.

vehicleType string

the type of vehicle to use for routing analysis; allowed values are PEDESTRIAN,BIKE, CAR. If parameter has in invalid value, PEDESTRIAN is used per default.

Returns:

the distance matrix between the submitted source and destination points based on waypath routing.

Type
object

(async, static) exports.distance_waypath_kilometers(point_A, point_B, vehicleType) → {number}

Source:
See:
  • openrouteservice_url CONSTANT
  • distance_direct_kilometers

Performs a GET request against /routes endpoint of the openrouteservice instance specified via the CONSTANT openrouteservice_url (version 4.7.2) to aquire the distance between the submitted points based on waypath routing.

Parameters:
Name Type Description
point_A Feature.<Point>

valid GeoJSON Feature with geometry type Point - the coordinates are expected to follow the order latitude

point_B Feature.<Point>

valid GeoJSON Feature with geometry type Point - the coordinates are expected to follow the order latitude

vehicleType string

the type of vehicle to use for routing analysis; allowed values are PEDESTRIAN,BIKE, CAR. If parameter has in invalid value, PEDESTRIAN is used per default.

Returns:

the distance between the submitted points in kilometers based on waypath routing (thus, the distance is likely to be greater then the direct distance computed by distance_direct_kilometers).

Type
number

(async, static) exports.duration_matrix_seconds(locations, sourceIndices, destinationIndices, vehicleType) → {object}

Source:
See:
  • openrouteservice_url CONSTANT

Performs a POST request against /matrix endpoint of the openrouteservice instance specified via the CONSTANT openrouteservice_url (version 4.7.2) to aquire the duration matrix for the submitted source and destinations points based on waypath routing.

Example
// examplar response to show how distance matrix is structured
{
    "durations": [
        [
            259,
            455
        ],
        [
            205,
            26
        ]
    ]
    "destinations": [
        {
            "location": [
                7.019859,
                51.458106
            ],
            "name": "Severinstraße",
            "snapped_distance": 24.9
        },
        {
            "location": [
                7.032748,
                51.445316
            ],
            "name": "",
            "snapped_distance": 12.44
        }
    ],
    "sources": [
        {
            "location": [
                7.007574,
                51.475965
            ],
            "name": "Gladbecker Straße, B 224",
            "snapped_distance": 0.35
        },
        {
            "location": [
                7.001853,
                51.449557
            ],
            "name": "",
            "snapped_distance": 1.98
        }
    ],
    "info": {
        "service": "matrix",
        "engine": {
            "version": "4.7.2",
            "build_date": "2019-03-29T11:38:45Z"
        },
        "attribution": "openrouteservice.org, OpenStreetMap contributors",
        "timestamp": 1560748456760,
        "query": {
            "profile": "foot-walking",
            "units": "seconds"
        }
    }
}
Parameters:
Name Type Description
locations Array.Feature.<Point>

array of valid GeoJSON Features with geometry type Point - the coordinates are expected to follow the order latitude. WARNING: it might be possible, that the queried instance of OpenRouteService has a configuration for maximum number of allowed locations per request (i.e. 200 is default configuration), causing the request to fail.

sourceIndices String

the indices pointing to such points within submitted locations, that shall be used as source points for matrix analysis, as comma-separated string of indices. Required format: 'index1,index2,index3,...'. A check, whether the index string contains indices that do not match the locations array, is not performed.

destinationIndices String

the indices pointing to such points within submitted locations, that shall be used as destination points for matrix analysis, as comma-separated string of indices. Required format: 'index4,index5,index6,...'. A check, whether the index string contains indices that do not match the locations array, is not performed.

vehicleType string

the type of vehicle to use for routing analysis; allowed values are PEDESTRIAN,BIKE, CAR. If parameter has in invalid value, PEDESTRIAN is used per default.

Returns:

the duration matrix between the submitted source and destination points based on waypath routing.

Type
object

(static) exports.intersection(polygonFeature_A, polygonFeature_B) → {Feature|null}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#intersect to compute the intersection between two polygonal GeoJSON features.

Parameters:
Name Type Description
polygonFeature_A Feature.<Polygon>

a GeoJSON feature of type Polygon

polygonFeature_B Feature.<Polygon>

a GeoJSON feature of type Polygon

Returns:

returns a GeoJSON feature representing the point(s) they share (in case of a Point or MultiPoint ), the borders they share (in case of a LineString or a MultiLineString ), the area they share (in case of Polygon or MultiPolygon ). If they do not share any point, returns null

Type
Feature | null

(static) exports.intersectLineFeatureCollectionByPolygonFeature(featureCollection, feature) → {FeatureCollection.<LineString>}

Source:

Computes the intersections of linestrings of a feature collection and a polygon feature

Parameters:
Name Type Description
featureCollection FeatureCollection.<LineString>

a valid GeoJSON FeatureCollection

feature Feature.<Polygon>

a valid GeoJSON Feature

Returns:

returns the georesource as FeatureCollection.<LineString>

Type
FeatureCollection.<LineString>

(static) exports.intersects(feature_A, feature_B) → {boolean}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#booleanDisjoint and negates the result to check if the submitted GeoJSON features intersect each other.

Parameters:
Name Type Description
feature_A Feature

a GeoJSON feature of any type

feature_B Feature

a GeoJSON feature of any type

Returns:

returns true, if both features intersect each other.

Type
boolean

(async, static) exports.isochrones_byDistance(startingPoints, vehicleType, travelDistanceInMeters, dissolve, deactivateLog, avoid_features) → {FeatureCollection.<Polygon>}

Source:
See:
  • openrouteservice_url CONSTANT

Performs a GET request against /isochrones endpoint of the openrouteservice instance specified via the CONSTANT openrouteservice_url (version 4.7.2) to aquire the reachability isochrones by distance (equidistance) starting from the submitted points based on waypath routing. If the number of startingPoints is greater than allowed number of max locations ({@see maxLocationsForORSRequest}), startingPoints will be plit up and multiple requests will be made. Results will be combined to a single FeatureCollection.

Parameters:
Name Type Description
startingPoints Array.<Feature.<Point>>

array of valid GeoJSON Features with geometry type Point - the coordinates are expected to follow the order latitude

vehicleType string

the type of vehicle to use for routing analysis; allowed values are PEDESTRIAN,BIKE, CAR. If parameter has in invalid value, PEDESTRIAN is used per default.

travelDistanceInMeters number

the travel distance to compute the isochrones (equidistance) in meters

dissolve boolean

if multiple starting points were specified this optional parameter controls whether the returned isochrones shall be dissolved or not - default value is false

deactivateLog boolean

set to true to deactivate log statements (i.e. when calling the method for thousands of starting points separately) - default value is false

avoid_features string | null

may specify a featureType of routing network that shall be avoided. possible values are tollways, ferries, tunnels, pavedroads, unpavedroads, tracks, fords, steps, hills

Returns:

the reachability isochrones as GeoJSON FeatureCollection; if multiple starting points were specified the resulting isochrones for each point are dissolved as far as possible.

Type
FeatureCollection.<Polygon>

(async, static) exports.isochrones_byTime(startingPoints, vehicleType, travelTimeInSeconds, customMaxSpeedInKilometersPerHour, dissolve, deactivateLog, avoid_features) → {FeatureCollection.<Polygon>}

Source:
See:
  • openrouteservice_url CONSTANT

Performs a GET request against /isochrones endpoint of the openrouteservice instance specified via the CONSTANT openrouteservice_url (version 4.7.2) to aquire the reachability isochrones by time starting from the submitted points based on waypath routing. If the number of startingPoints is greater than allowed number of max locations ({@see maxLocationsForORSRequest}), startingPoints will be plit up and multiple requests will be made. Results will be combined to a single FeatureCollection.

Parameters:
Name Type Description
startingPoints Array.<Feature.<Point>>

array of valid GeoJSON Features with geometry type Point - the coordinates are expected to follow the order latitude

vehicleType string

the type of vehicle to use for routing analysis; allowed values are PEDESTRIAN,BIKE, CAR. If parameter has in invalid value, PEDESTRIAN is used per default.

travelTimeInSeconds number

the travel time to compute the isochrones in seconds

customMaxSpeedInKilometersPerHour number | null

a custom maximum speed to use for isochrone computation or null to use defaults from OpenRouteService

dissolve boolean

if multiple starting points were specified this optional parameter controls whether the returned isochrones shall be dissolved or not - default value is false

deactivateLog boolean

set to true to deactivate log statements (i.e. when calling the method for thousands of starting points separately) - default value is false

avoid_features string | null

may specify a featureType of routing network that shall be avoided. possible values are tollways, ferries, tunnels, pavedroads, unpavedroads, tracks, fords, steps, hills

Returns:

the reachability isochrones as GeoJSON FeatureCollection; if multiple starting points were specified the resulting isochrones for each point are dissolved as far as possible.

Type
FeatureCollection.<Polygon>

(static) exports.nearestPoint_directDistance(targetPoint, pointCollection) → {Feature.<Point>}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#nearestPoint to identify the nearest point of a point collection.

Parameters:
Name Type Description
targetPoint Feature.<Point>

a GeoJSON feature with geometry type Point, for which the nearest point will be searched

pointCollection FeatureCollection.<Point>

a GeoJSON FeatureCollection of features with geometry type Point

Returns:

returns the nearest GeoJSON Point Feature with the shortest direct distance to targetPoint.

Type
Feature.<Point>

(async, static) exports.nearestPoint_waypathDistance(targetPoint, pointCollection, vehicleType) → {Feature.<Point>}

Source:
See:

Identifies the nearest point of a pointCollection which has the shortest waypath distance to targetPoint. In contrast to method nearestPoint_directDistance, this method computes the distance based on waypaths of the corresponding vehicleType. It makes use of method distance_waypath_kilometers, which queries Open Route Service for waypath routing between two points.

Parameters:
Name Type Description
targetPoint Feature.<Point>

a GeoJSON feature with geometry type Point, for which the nearest point will be searched

pointCollection FeatureCollection.<Point>

a GeoJSON FeatureCollection of features with geometry type Point

vehicleType string

the type of vehicle to use for routing analysis; allowed values are PEDESTRIAN,BIKE, CAR. If parameter has in invalid value, PEDESTRIAN is used per default.

Returns:

returns the nearest GeoJSON Point Feature with the shortest waypath distance to targetPoint.

Type
Feature.<Point>

(static) exports.nearestPointOnLine_directDistance(targetPoint, lineString) → {Feature.<Point>}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#nearestPointOnLine to identify the nearest point on the submitted line.

Parameters:
Name Type Description
targetPoint Feature.<Point>

a GeoJSON feature with geometry type Point, for which the nearest point will be searched

lineString Feature.<(LineString|MultiLineString)>

a GeoJSON feature with geometry type LineString or MultiLineString

Returns:

returns the nearest GeoJSON Point Feature with the shortest direct distance to targetPoint. Furthermore it contains the property dist, which contains the direct distance to targetPoint in kilometers.

Type
Feature.<Point>

(static) exports.nearestPointOnLines_directDistance(targetPoint, lineStringCollection) → {Feature.<Point>}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#nearestPointOnLine to identify the nearest point for the nearest line of the submitted lines.

Parameters:
Name Type Description
targetPoint Feature.<Point>

a GeoJSON feature with geometry type Point, for which the nearest point will be searched

lineStringCollection FeatureCollection.<(LineString|MultiLineString)>

a GeoJSON FeatureCollection of features with geometry type LineString or MultiLineString

Returns:

returns the nearest GeoJSON Point Feature with the shortest direct distance to targetPoint. Furthermore it contains the property dist, which contains the direct distance to targetPoint in kilometers.

Type
Feature.<Point>

(static) exports.nearestPointOnPolygon_directDistance(targetPoint, polygon) → {Feature.<Point>}

Source:
See:

Utilizes turf functions https://turfjs.org/docs/#polygonToLine to split up the Polygon|Multipolygon to LineStrings and https://turfjs.org/docs/#nearestPointOnLine to identify the nearest point on the lines of the polygon.

Parameters:
Name Type Description
targetPoint Feature.<Point>

a GeoJSON feature with geometry type Point, for which the nearest point will be searched

polygon Feature.<(Polygon|MultiPolygon)>

a GeoJSON feature with geometry type Polygon or MultiPolygon

Returns:

returns the nearest GeoJSON Point Feature with the shortest direct distance to targetPoint. Furthermore it contains the property dist, which contains the direct distance to targetPoint in kilometers.

Type
Feature.<Point>

(static) exports.nearestPointOnPolygons_directDistance(targetPoint, polygonCollection) → {Feature.<Point>}

Source:
See:

Utilizes turf functions https://turfjs.org/docs/#polygonToLine to split up the input Polygons|Multipolygons to LineStrings and https://turfjs.org/docs/#nearestPointOnLine to identify the nearest point on the lines of the polygons.

Parameters:
Name Type Description
targetPoint Feature.<Point>

a GeoJSON feature with geometry type Point, for which the nearest point will be searched

polygonCollection Feature.<(Polygon|MultiPolygon)>

a GeoJSON FeatureCollection of features with geometry type Polygon or MultiPolygon

Returns:

returns the nearest GeoJSON Point Feature with the shortest direct distance to targetPoint. Furthermore it contains the property dist, which contains the direct distance to targetPoint in kilometers.

Type
Feature.<Point>

(static) exports.overlap(feature_A, feature_B) → {boolean}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#booleanOverlap to check if the submitted GeoJSON features overlaop each other.

Parameters:
Name Type Description
feature_A Feature

a GeoJSON feature of any type

feature_B Feature

a GeoJSON feature of any type

Returns:

returns true, if feature_A overlaps partially with feature_B.

Type
boolean

(static) exports.pointOnFeature(geoJSON) → {Feature.<Point>}

Source:
See:

Encapsulates turf functions https://turfjs.org/docs/#buffer https://turfjs.org/docs/#pointOnFeature to compute the a point guaranteed to be on the surface of submitted feature. It buffers the feature with negative radius and then performs pointOnfeature method to ensure that the computet point is definitly within feature. Only pointOnFeature sometimes places point on border and - due to coordinate rounding etc. - point might be within other feature...

Parameters:
Name Type Description
geoJSON GeoJSON

valid GeoJSON object.

Returns:

the GeoJSON point feature on the surface of the submitted features.

Type
Feature.<Point>

(static) exports.pointsWithinPolygon(points, polygons) → {FeatureCollection}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#pointsWithinPolygon to find all points that lie within polygons.

Parameters:
Name Type Description
points Feauture | FeatureCollection

a GeoJSON point features

polygons FeatureCollection | Geometry | Feature

a GeoJSON polygon|multipolygon features

Returns:

returns all points that lie within at least one polygon of submitted polygons as .

Type
FeatureCollection

(static) exports.summarizeLineSegmentLengths(featureCollection) → {number}

Source:

Computes the length of all line segments of a linestring feature collection

Parameters:
Name Type Description
featureCollection FeatureCollection.<LineString>

a valid GeoJSON FeatureCollection

Returns:

returns the length of all line segements of the FeatureCollection.<LineString>

Type
number

(static) exports.union(polygonFeature_A, polygonFeature_B) → {Feature.<(Polygon|MultiPolygon)>|null}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#union to compute the union of two or more polygonal GeoJSON features.

Parameters:
Name Type Description
polygonFeature_A Feature.<(Polygon|MultiPolygon)>

a GeoJSON feature of type Polygon

polygonFeature_B Feature.<(Polygon|MultiPolygon)>

a GeoJSON feature of type Polygon

Returns:

the GeoJSON feature of type MultiPolygon representing the union of the submitted features or null.

Type
Feature.<(Polygon|MultiPolygon)> | null

(static) exports.within(feature_A, feature_B) → {boolean}

Source:
See:

Encapsulates turf function https://turfjs.org/docs/#booleanWithin to check if the submitted GeoJSON feature feature_A lies within feature_B.

Parameters:
Name Type Description
feature_A Feature

a GeoJSON feature of any type

feature_B Feature

a GeoJSON feature of any type

Returns:

returns true, if feature_A lies within feature_B.

Type
boolean

(static) exports.within_usingBBOX(feature_A, feature_B) → {boolean}

Source:
See:

This method is an alternative implementation of a spatial within function for spatial features. First of all, it computes bounding boxes of the relevant features to speed up the spatial comparison. Furthermore, instead of checking whether feature_A lies completely within feature_B, it inspects whether the bounding boxes overlap for more than 90.0%. If the features's geometries might contain faulty coordinates for whatever reason that would cause a strict spatial within comparison to output false, this alternative approach ensures that such small coordinate failures will still result in a positive within check.

Parameters:
Name Type Description
feature_A Feature.<Polygon>

a base indicator (input) feature as GeoJSON feature

feature_B Feature.<Polygon>

a target feature as GeoJSON feature (for which indicator results shall be computed)

Returns:

returns true if the feature_A lies within feature_B (precisely, if their bounding boxes overlap for more than 90.0%); false otherwise

Type
boolean