3.0.0 • Published 9 months ago

@polar/plugin-pins v3.0.0

Weekly downloads
-
License
EUPL-1.2
Repository
github
Last release
9 months ago

Pins

Scope

The pins plugin handles marking locations. Embedding processes can then use that coordinate for further steps. The plugin may react to other plugins, especially address searches.

Configuration

The usage of displayComponent has no influence on the creation of Pins on the Map if this plugin is being used.

pins

fieldNametypedescription
appearOnClickappearOnClick?Pin restrictions. See object description below.
boundaryLayerIdstring?Id of a vector layer to restrict pins to. When pins are moved or created outside of the boundary, an information will be shown and the pin is reset to its previous state. The map will wait at most 10s for the layer to load; should it not happen, the geolocation feature is turned off.
boundaryOnError('strict' | 'permissive')?If the boundary layer check does not work due to loading or configuration errors, style 'strict' will disable the pins feature, and style 'permissive' will act as if no boundaryLayerId was set. Defaults to 'permissive'.
coordinateSourcestring?The pins plugin may react to changes in other plugins. This specifies the path to such store positions. The position must, when subscribed to, return a GeoJSON feature. Please mind that, when referencing another plugin, that plugin must be in addPlugins before this one.
initialinitial?Configuration options for setting an initial pin.
movableenum"drag", "click", "none"?Whether a user may drag and re-click the pin (drag), only re-click it (click) or may only be placed programmatically (none). Defaults to 'none'.
stylestyle?Display style configuration.
toastActionstring?If boundaryLayerId is set, and the pin is moved or created outside the boundary, this string will be used as the path to an action within the store to send a toast notification to the user. If no toast notification is desired, leave this field undefined; for testing purposes, you can still find information in the console.
toZoomLevelnumber?Zoom level to use on outside input by e.g. address search. Defaults to 0.

Example configuration:

pins: {
  toZoomLevel: 9,
  movable: 'drag',
  appearOnClick: {
    show: true,
    atZoomLevel: 3,
  },
  style: {
    fill: '#003064',
  },
  boundaryLayerId: 'hamburgBorder',
  toastAction: 'plugin/toast/addToast',
  coordinateSource: 'plugin/addressSearch/chosenAddress'
}

pins.appearOnClick

fieldNametypedescription
showbooleanDisplay marker.
atZoomLevelnumber?Minimum zoom level for sensible marking. Defaults to 0.

Example configuration:

appearOnClick: {
  show: true,
  atZoomLevel: 3,
}

pins.initial

fieldNametypedescription
coordinatesnumber[]Coordinate pair for the pin.
centerOnboolean?If set to true, center on and zoom to the given coordinates on start. Defaults to false.
epsgstring?Coordinate reference system in which the given coordinates are encoded. Defaults to the epsg value defined in the mapConfiguration.

Example configuration:

initial: {
  coordinates: [611694.909470, 5975658.233007],
  centerOn: true,
  epsg: 'EPSG:25832'
}

pins.style

fieldNametypedescription
fillstring?Fill color of the pin. Defaults to blue (#005CA9).
strokestring?Stroke (that is, border) color of the pin. Defaults to white (#FFFFFF).

Example configuration:

style: {
  fill: '#003064',
  stroke: '#000000'
}

Store

State

map.subscribe('plugin/pins/transformedCoordinate', (pinCoordinate) => {
  /* Your Code. */
})

The pinCoordinate is of type [number, number].

map.subscribe('plugin/pins/latLon', (pinCoordinate) => {
  /* Your Code. */
})

The pinCoordinate is transcribed to latitude / longitude.

3.0.0

9 months ago

2.0.0

11 months ago

1.3.1

2 years ago

2.0.0-alpha.3

2 years ago

2.0.0-alpha.2

2 years ago

2.0.0-alpha.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago