new GeometryUtil()
Helper Class for the geospatial analysis.
- Source:
Members
MULTI_GEOM_PREFIX
The prefix used to detect multi geometries.
- Source:
Methods
(static) addBuffer(geometry, buffer, projection) → {ol.geom.Geometry|ol.Feature}
Adds a buffer to a given geometry. If the target is of type ol.Feature it will return an ol.Feature. If the target is of type ol.geom.Geometry it will return ol.geom.Geometry.
Parameters:
Name | Type | Description |
---|---|---|
geometry |
ol.geom.Geometry | ol.Feature | The geometry. |
buffer |
Number | The buffer to add in meters. |
projection |
String | The projection of the input geometry as EPSG code. Default is to EPSG:3857. |
Returns:
The geometry or feature with the added buffer.
- Type
- ol.geom.Geometry | ol.Feature
(static) difference(feature, feature, projection) → {ol.geom.Geometry|ol.Feature}
Finds the difference between two polygons by clipping the second polygon from the first.
Parameters:
Name | Type | Description |
---|---|---|
feature |
ol.geom.Geometry | ol.Feature | An ol.geom.Geoemtry or ol.Feature |
feature |
ol.geom.Geometry | ol.Feature | An ol.geom.Geoemtry or ol.Feature |
projection |
String | The projection of the input polygons as EPSG code. Default is to EPSG:3857. |
Returns:
A Feature or Geometry with the area of polygon1 excluding the area of polygon2.
- Type
- ol.geom.Geometry | ol.Feature
(static) intersection(polygon1, polygon2, projection) → {ol.geom.Geometry|ol.Feature}
Takes two polygons and finds their intersection. If the polygons are of type ol.Feature it will return an ol.Feature. If the polygons are of type ol.geom.Geometry it will return an ol.geom.Geometry.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
polygon1 |
ol.geom.Geometry | ol.Feature | An ol.geom.Geoemtry or ol.Feature |
|
polygon2 |
ol.geom.Geometry | ol.Feature | An ol.geom.Geoemtry or ol.Feature |
|
projection |
String | EPSG:3857 | The projection of the input polygons as EPSG code. Default is to EPSG:3857. |
Returns:
A Feature or Geometry with the shared area of the two polygons or null if the polygons don't intersect.
- Type
- ol.geom.Geometry | ol.Feature
(static) mergeGeometries(geometries) → {ol.geom.Multipoint|ol.geom.MultiPolygon|ol.geom.MultiLinestring}
Merges multiple geometries into one MultiGeometry.
Parameters:
Name | Type | Description |
---|---|---|
geometries |
Array.<ol.geom.Geometry> | An array of ol.geom.geometries; |
Returns:
A Multigeometry.
- Type
- ol.geom.Multipoint | ol.geom.MultiPolygon | ol.geom.MultiLinestring
(static) separateGeometries(geometries) → {Array.<ol.geom.Point>|Array.<ol.geom.Polygon>|Array.<ol.geom.LineString>}
Splits an array of geometries (and multi geometries) or a single MultiGeom into an array of single geometries.
Attention: ol.geom.Circle and ol.geom.LinearRing are not supported.
Parameters:
Name | Type | Description |
---|---|---|
geometries |
ol.geom.SimpleGeometry | Array.<ol.geom.SimpleGeometry> | An (array of) ol.geom.geometries; |
Returns:
An array of geometries.
- Type
- Array.<ol.geom.Point> | Array.<ol.geom.Polygon> | Array.<ol.geom.LineString>
(static) splitByLine(polygon, lineFeat, projection, tolerance) → {Array.<ol.Feature>|Array.<ol.geom.Polygon>}
Splits an ol.feature with/or ol.geom.Polygon by an ol.feature with/or ol.geom.LineString into an array of instances of ol.feature with/or ol.geom.Polygon. If the target polygon (first param) is of type ol.Feature it will return an array with ol.Feature. If the target polygon (first param) is of type ol.geom.Geometry it will return an array with ol.geom.Geometry.
Parameters:
Name | Type | Description |
---|---|---|
polygon |
ol.feature | ol.geom.Polygon | The polygon geometry to split. |
lineFeat |
ol.feature | ol.geom.LineString | The line geometry to split the polygon geometry with. |
projection |
ol.ProjectionLike | The EPSG code of the input features. Default is to EPSG:3857. |
tolerance |
Number | The tolerance (in meters) used to find if a line vertex is inside the polygon geometry. Default is to 10. |
- Source:
Returns:
An array of instances of ol.feature with/or ol.geom.Polygon
- Type
- Array.<ol.Feature> | Array.<ol.geom.Polygon>
(static) union(polygons, projection) → {ol.geom.Geometry|ol.Feature}
Takes two or more polygons and returns a combined polygon.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
polygons |
Array.<ol.geom.Geometry> | Array.<ol.Feature> | An array of ol.Feature or ol.geom.Geometry instances of type polygon. |
|
projection |
String | EPSG:3857 | The projection of the input polygons as EPSG code. Default is to EPSG:3857. |
Returns:
A Feature or Geometry with the combined area of the polygons.
- Type
- ol.geom.Geometry | ol.Feature