Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: documentation for position control DMS format #240

Merged
merged 3 commits into from
Feb 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 38 additions & 5 deletions content/controls.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,22 +546,55 @@ Option | Description

### Position

Control to show coordinates. Mouse position and center position of the map can be toggled. Coordinates can be searched on in the center position mode.
Control to show coordinates of the mouse cursor or map center and navigate to coordinate. The control supports multiple coordinate systems that can be toggled by clicking
the coordinate system label. By clicking the hair cross the functionality toggles between displaying mouse position or map center. In map center mode
it is possible to navigate to a coordinate by entering a new value in the coordinate display box.

Property | Description
---|---
`name` | the name of the control (position)
`options` | options for the control
`name` | The name of the control. Required. For position contol name is "position".
`options` | A _positionControlOptions_ object

__positionControlOptions__

Option | Description
---|---
`title` | alias name of the current map projection to be displayed.
`projections` | object of projections to toggle between. Projection code and alias name is required for each projection. The projection must be defined in proj4Defs, except EPSG:4326 and EPS:3857 which are included by default.
`title` | alias name of the current map projection to be displayed. Optional. If specified it is the first in the toggle loop.
`projections` | Array of _positionControlProjectionConfiguration_ objects that defines which projections are possible to toggle between. The projection must be defined in proj4Defs, except EPSG:4326 and EPS:3857 which are included by default. Alternatively `projections` can be an object with projection codes as properties and display name as value.
`noPositionText` | when empty last mouse position is rendered else text of choise renders. If this option is not defined, no coordinates when no mouse position.
`hideWhenEmbedded` | if set to true, the control is not added when the map is embedded. Defaults to false.

__positionControlProjectionConfiguration__

Option | Description
---|---
`projectionCode` | String with the EPSG code e.g. "EPSG:4326". Required.
`projectionLabel`| String with text to display in the control for this projection. Required.
`dms` | Bool. If true coordinates are displayed in Degree minute second format. Optional, defaults to false.
`precision` | Number of decimals in the coordinate. If `dms` is true, it sets the number of decimals of _seconds_. Optional, defaults to 0 for all coordinate systems except EPSG:4326, for which it defaults to 5 if not using _dms_.

#### Example position control
```json
{
"name": "position",
"options": {
"projections": [
{
"projectionCode": "EPSG:4326",
"projectionLabel": "Wgs84"
},
{
"projectionCode": "EPSG:4326",
"projectionLabel": "Wgs84 DMS",
"dms": true,
"precision": 2
}
]
}
}
```

#### Example position control using simplified configuration format

```json
{
Expand Down