From baa593fd96b53a4a40bdd007bdb9fff926e99265 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Thu, 12 Aug 2021 09:56:29 +0200 Subject: [PATCH] add drawMode example to readme --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index 2a9181ae..19a9a96f 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,39 @@ geojsonBuffer = 15; `geojsonColor` & `geojsonBuffer` are optional style properties. Color sets the stroke of the displayed data and buffer is used to fit the map view to the extent of the geojson features. `geojsonBuffer` corresponds to "value" param in OL documentation [here](https://openlayers.org/en/latest/apidoc/module-ol_extent.html). +#### Example: draw a custom polygon & calculate its' area + +```html + + + + +``` + +Available properties & their default values: +```js +@property({ type: Boolean }) +drawMode = false; + +@property({ type: Number }) +latitude = 51.507351; + +@property({ type: Number }) +longitude = -0.127758; + +@property({ type: Number }) +zoom = 10; +``` + +Set `drawMode` to true. `latitude`, `longitude`, and `zoom` are used to set the initial map view. Drawing style is red by default, consistent with site plan standards in the UK. + +We currently limit drawing to a single polygon. After you close your polygon, you can modify it by clicking on an edge and dragging. The `↻` button will clear your drawing and recenter the map. Add an optional event listener to log the total area in square metres. + #### Example: highlight features that intersect with a given coordinate ```html