3.0.0
This class provides some static methods which might be helpful when working with digitize functions to animate features.
Moves / translates an OlFeature
to the given pixel
delta in
in the end with given duration
in ms, using the given style.
(ol.Map)
An OlMap.
(ol.Feature)
The feature to move.
(number)
The duration in ms for the moving to complete.
(ol.style.Style)
The style to use when moving the feature.
string
:
A listener key from a postcompose event.
Helper class to parse capabilities of WMS layers
Returns the layers from a parsed WMS GetCapabilities object.
(Object)
A capabilities object.
(string
= 'Name'
)
Configure the field which should be set as the
'name' property in the openlayers layer.
(Function)
Optional proxy function which can be applied to
GetMap
,
GetFeatureInfo
and
GetLegendGraphic
requests to avoid CORS issues.
Array<OlLayerTile>
:
Array of OlLayerTile
Helper class for working with OpenLayers features.
Returns the featureType name out of a given feature. It assumes that the feature has an ID in the following structure FEATURETYPE.FEATUREID.
(ol.Feature)
The feature to obtain the featureType
name from.
string
:
The (unqualified) name of the featureType or undefined if
the name could not be picked.
Extracts the featureType name from given GetFeatureInfo URL. This method is mostly useful for raster layers which features could have no ID set.
(string)
GetFeatureInfo URL possibly containing featureType name.
(boolean
= true
)
Whether the qualified featureType name should be
returned or not. Default is true.
string
:
Obtained featureType name as string.
Resolves the given template string with the given feature attributes, e.g. the template "Size of area is {{AREA_SIZE}} km²" would be to resolved to "Size of area is 1909 km²" (assuming the feature's attribute AREA_SIZE really exists).
(ol.Feature)
The feature to get the attributes from.
(string)
The template string to resolve.
(string?
= 'n.v.'
)
The text to apply, if the templated value
could not be found, default is to 'n.v.'.
(Function?
= (key,val)=>val
)
A method that will be called with each
key/value match, we'll use what this function returns for the actual
replacement. Optional, defaults to a function which will return the raw
value it received. This can be used for last minute adjustments before
replacing happens, e.g. to filter out falsy values or to do number
formatting and such.
string
:
The resolved template string.
Helper class for adding layers from various file formats.
Adds a new vector layer from a geojson file.
(File)
the file to read the geojson from
(ol.Map)
the map to add the layer to
Adds a new vector layer from a shape file (zip).
(File)
the file to read the geojson from
(ol.Map)
the map to add the layer to
Helper class for the geospatial analysis. Makes use of Turf.js.
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.
((ol.Feature | ol.geom.Polygon))
The polygon geometry to split.
((ol.Feature | ol.geom.LineString))
The line geometry to split the polygon
geometry with.
(ol.ProjectionLike
= 'EPSG:3857'
)
The EPSG code of the input features.
Default is to EPSG:3857.
(Array<ol.Feature> | Array<ol.geom.Polygon>)
:
An array of instances of ol.feature
with/or ol.geom.Polygon
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.
((ol.geom.Geometry | ol.Feature))
The geometry.
(number
= 0
)
The buffer to add in meters.
(string
= 'EPSG:3857'
)
The projection of the input geometry as EPSG code.
Default is to EPSG:3857.
(ol.geom.Geometry | ol.Feature)
:
The geometry or feature with the added buffer.
Merges multiple geometries into one MultiGeometry.
(Array<ol.geom.Geometry>)
An array of ol.geom.geometries;
(ol.geom.MultiPoint | ol.geom.MultiPolygon | ol.geom.MultiLineString)
:
A Multigeometry.
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.
((ol.geom.SimpleGeometry | Array<ol.geom.SimpleGeometry>))
An (array of) ol.geom.geometries;
(Array<ol.geom.Point> | Array<ol.geom.Polygon> | Array<ol.geom.LineString>)
:
An array of geometries.
Takes two or more polygons and returns a combined (Multi-)polygon.
(string
= 'EPSG:3857'
)
The projection of the input polygons as EPSG code.
Default is to EPSG:3857.
(ol.geom.Geometry | ol.Feature)
:
A Feature or Geometry with the
combined area of the (Multi-)polygons.
Finds the difference between two polygons by clipping the second polygon from the first.
((ol.geom.Geometry | ol.Feature))
An ol.geom.Geometry or ol.Feature
((ol.geom.Geometry | ol.Feature))
An ol.geom.Geometry or ol.Feature
(string
= 'EPSG:3857'
)
The projection of the input polygons as EPSG code.
Default is to EPSG:3857.
(ol.geom.Geometry | ol.Feature)
:
A Feature or Geometry with the area
of polygon1 excluding the area of polygon2. The type of the first polygon
(geometry or feature) determines the return type.
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.
((ol.geom.Geometry | ol.Feature))
An ol.geom.Geometry or ol.Feature
((ol.geom.Geometry | ol.Feature))
An ol.geom.Geometry or ol.Feature
(string
= 'EPSG:3857'
)
The projection of the input polygons as EPSG code.
Default is to EPSG:3857.
(ol.geom.Geometry | ol.Feature)
:
A Feature or Geometry with the
shared area of the two polygons or null if the polygons don't intersect.
Helper class for the OpenLayers map.
Returns all interactions of the given class of the passed map.
(ol.Map)
The map to use for lookup.
(ol.interaction)
The class of the interaction to look for.
Array<ol.interaction>
:
The list of result interactions.
Calculates the appropriate map resolution for a given scale in the given units.
See: https://gis.stackexchange.com/questions/158435/ how-to-get-current-scale-in-openlayers-3
(number)
The input scale to calculate the appropriate
resolution for.
(string)
The units to use for calculation (m or degrees).
number
:
The calculated resolution.
Returns all layers of a collection. Even the hidden ones.
((ol.Map | ol.layer.Group))
The collection to get the layers
from. This can be an ol.layer.Group
or an ol.Map.
(Function?
= ()=>true
)
A filter function that receives the layer.
If it returns true it will be included in the
returned layers.
Array
:
An array of all Layers.
Get a layer by its key (ol_uid).
(ol.Map)
The map to use for lookup.
(string)
The ol_uid of a layer.
ol.layer.Layer
:
The layer.
Returns the layer from the provided map by the given name (parameter LAYERS).
(ol.Map)
The map to use for lookup.
(string)
The name to get the layer by.
ol.Layer
:
The result layer or undefined if the layer could not
be found.
Returns the layer from the provided map by the given feature.
(ol.Map)
The map to use for lookup.
(ol.Feature)
The feature to get the layer by.
(Array)
list of supported GeoServer namespaces.
ol.Layer
:
The result layer or undefined if the layer could not
be found.
Get information about the LayerPosition in the tree.
(ol.layer.Layer)
The layer to get the information.
((ol.layer.Group | ol.Map)?)
The groupLayer or map
containing the layer.
Object
:
An object with these keys:
{ol.layer.Group} groupLayer The groupLayer containing the layer.
{Integer} position The position of the layer in the collection.
Get the getlegendGraphic url of a layer. Designed for geoserver. Currently supported Sources:
(ol.layer.Layer)
The layer that you want to have a legendUrlfor.
(any)
(string | undefined)
:
The getLegendGraphicUrl.
Checks whether the resolution of the passed map's view lies inside of the min- and max-resolution of the passed layer, e.g. whether the layer should be displayed at the current map view resolution.
(ol.layer.Layer)
The layer to check.
(ol.Map)
The map to get the view resolution for comparison
from.
boolean
:
Whether the resolution of the passed map's view lies
inside of the min- and max-resolution of the passed layer, e.g. whether
the layer should be displayed at the current map view resolution. Will
be
false
when no
layer
or no
map
is passed or if the view of the
map is falsy or does not have a resolution (yet).
Returns the appropriate zoom level for the given scale and units.
(number)
Map scale to get the zoom for.
(Array)
Resolutions array.
(string
= 'm'
)
The units the resolutions are based on, typically
either 'm' or 'degrees'. Default is 'm'.
number
:
Determined zoom level for the given scale.
This class provides some static methods which might be helpful when working with measurements.
Get the length of a OlGeomLineString.
(OlGeomLineString)
The drawn line.
(OlMap)
An OlMap.
(boolean
= true
)
Is the measurement geodesic (default is true).
(number
= 6371008.8
)
Sphere radius. By default, the radius of the earth
is used (Clarke 1866 Authalic Sphere, 6371008.8).
number
:
The length of line in meters.
Format length output for the tooltip.
(OlGeomLineString)
The drawn line.
(OlMap)
An OlMap.
(number)
How many decimal places will be
allowed for the measure tooltips
(boolean
= true
)
Is the measurement geodesic (default is true).
string
:
The formatted length of the line.
Get the area of a OlGeomPolygon.
(OlGeomPolygon)
The drawn polygon.
(OlMap)
An OlMap.
(boolean
= true
)
Is the measurement geodesic (default is true).
(number
= 6371008.8
)
Sphere radius. By default, the radius of the earth
is used (Clarke 1866 Authalic Sphere, 6371008.8).
number
:
The area of the polygon in square meter.
Format length output for the tooltip.
(OlGeomPolygon)
The drawn polygon.
(OlMap)
An OlMap.
(number)
How many decimal places will be
allowed for the measure tooltips.
(boolean
= true
)
Is the measurement geodesic.
string
:
The formatted area of the polygon.
Determine the angle between two coordinates. The angle will be between -180° and 180°, with 0° being in the east. The angle will increase counter-clockwise.
Inspired by https://stackoverflow.com/a/31136507
number
:
the angle in degreees, ranging from -180° to 180°.
Determine the angle between two coordinates. The angle will be between 0° and 360°, with 0° being in the east. The angle will increase counter-clockwise.
Inspired by https://stackoverflow.com/a/31136507
number
:
the angle in degrees, ranging from 0° and 360°.
Given an angle between 0° and 360° this angle returns the exact opposite of the angle, e.g. for 90° you'll get back 270°. This effectively turns the direction of the angle from counter-clockwise to clockwise.
(number)
The input angle obtained counter-clockwise.
number
:
The clockwise angle.
This methods adds an offset of 90° to an counter-clockwise increasing angle of a line so that the origin (0°) lies at the top (in the north).
(number)
The input angle obtained counter-clockwise, with
0° degrees being in the east.
number
:
The adjusted angle, with 0° being in the north.
Returns the angle of the passed linestring in degrees, with 'N' being the 0°-line and the angle increases in clockwise direction.
(OlGeomLineString)
The linestring to get the
angle from. As this line is comming from our internal draw
interaction, we know that it will only consist of two points.
(number
= 2
)
How many decimal places will be
allowed for the measure tooltips.
string
:
The formatted angle of the line.
Default proj4 CRS definitions.
Default mappings for CRS identifiers (e.g. "urn:ogc:def:crs:EPSG::25832").
Helper class for projection handling. Makes use of Proj4js.
Registers custom CRS definitions to the application.
(Object)
The custom
proj4
definition strings
which should be registered additionally to default avaliable CRS (s.
defaultProj4CrsDefinitions
above) as well.
Further CRS definitions in proj4 format can be checked under
http://epsg.io
(e.g.
http://epsg.io/3426.proj4
).
(boolean
= true
)
Whether the default CRS should be
registered or not. Default is true.
Registers custom CRS mappings to allow automatic CRS detection. Sometimes
FeatureCollections returned by the GeoServer may be associated with
CRS identifiers (e.g. "urn:ogc:def:crs:EPSG::25832") that aren't
supported by proj4
and OpenLayers
per default. Add appropriate
mappings to allow automatic CRS detection by OpenLayers
here.
Helper class for building filters to be used with WFS GetFeature requests.
Creates GetFeature request body for all provided featureTypes and applies related filter encoding on it.
(Object)
Search options object which has the following
keys (see also
https://github.com/terrestris/react-geo/blob/master/src/Field/WfsSearch/
for further options explanations and examples):
(string)
Search string to be used with filter.