Creates a leaflet map.

Add the attribute "zoom" to provide an initial zoom level. Default is 8. If locations are given and no zoom level is provided, the zoom level will be set to fit the locations into the shown area.

Instead of "zoom" you can set the attribute "zoom-single". If locations are given, the single zoom level is used if only one location is given. Otherwise the zoom level will be set to fit the locations into the shown area.

Add the attributes "latitude" and "longitude" to define the center point of the map. If no latitude and longitude is given, the center will be calculated by using the given locations. A center has to be defined one way or the other.

To set locations on the map place hylo-map-location tags inside the hylo-leaflet-maps tag.

You can enable a full screen mode by defining content for the "open" and "close" fullscreen buttons by placing content in their slots. The buttons are positioned absolute. You have to define their exact position (css top, left ...) and style them. Their classes are "hylo-leaflet-maps .hylo-maps-fullscreen-open" and ".hylo-maps-fullscreen .hylo-maps-fullscreen-close". In full screen mode the leaflet map is placed inside a container with the class "hylo-maps-fullscreen". That means the map is not a child of the hylo-leaflet-maps component anymore in full screen mode.

Used slots:

  • fullscreen-open: the content of the open full screen button
  • fullscreen-close: the content of the close full screen button
  • cookies: content for the cookies layer

Properties

buttonAgreeClass: string = ''

Classes added to the button wrapped by the "agree to cookies" hylo-button.

centerEmpty: boolean

Only use the given latitude and longitude to center the map if no locations are given.

cookie: string = 'hylo_leaflet'

The cookie name to check for whether the user gave permission to use leaflet. The cookie's value has to be "1" to be considered set.

If not set, the component saves its own permissions in the session storage.

The cookies layer only appears if content for the cookies layer was provided.

cookiesAlways: boolean

Displays the cookies layer even if the user has agreed before already.

The cookies layer only appears if content for the cookies layer was provided.

cookiesLayerButtonsWrapperClass: string = ''

Classes added to the wrapper of the cookies buttons.

cookiesLayerClass: string = ''

Classes added to the cookies layer.

copyrightPosition: "topleft" | "topright" | "bottomleft" | "bottomright" = 'bottomleft'

Position of the copyright note.

fullScreenCloseClass: string = ''

Classes added to the fullscreen close button.

fullScreenKeepOpen: string | HTMLElement

On default the fullscreen closes automatically when an element outside the fullscreen layer gets the focus. If this element or a child of this element gets the focus, the fullscreen stays open.

The element can be defined as css query or directly as HTMLElement.

fullScreenLayerClass: string = ''

Classes added to the full screen layer.

fullScreenOpenClass: string = ''

Classes added to the fullscreen open button.

hyloButtonAgreeClass: string = ''

Classes added to the "agree to cookies" hylo-button.

latitude: string

Initial latitude (optional)

longitude: string

Initial longitude (optional)

mapClass: string = ''

Classes added to the direct map wrapper.

mapClick: Function

Gets called when a click event occurs on the map. The original event is passed as attribute.

mapHyloRouterLinkClick: Function

Gets called when a hyloRouterLinkClick event occurs on the map. The original event is passed as attribute.

noGestureHandling: boolean = false

By default, the gesture handling is enabled. With this option you can disable it.

textMapAgree: string = 'Zustimmen'

Text of the "agree to cookies".

type?: string = 'osm_mapnik'

The type of the map.

Possible values are:
wikimedia_maps_labels
wikimedia_maps_no_labels
wmf_labs_osm
wmf_labs_osm_no_labels
wmf_labs_osm_Multilingual
wmf_labs_hike_and_bike
wmf_labs_osm_black_and_white
wmf_labs_hill_shading
osm_mapnik

zoom: string

Initial zoom level (optional, default: 8)

zoomEmpty: boolean

Only use the given zoom if no locations are given. Applies only if "centerEmpty" is set.

zoomSingle: string

Initial zoom level if only one location is provided (optional)

Methods

  • Closes the full screen mode.

    Returns Promise<void>

  • Closes all open toolitps.

    Returns Promise<void>

  • Returns the actual map object.

    Returns Promise<any>

  • Returns the HtmlElement which wraps the map. This element is always the same no matter whether the map is displayed in full screen mode or not.

    Returns Promise<HTMLElement>

  • Returns whether the map is in full screen mode.

    Returns Promise<boolean>

  • Opens the map in full screen mode.

    Returns Promise<void>

  • Refreshes the graphics of the map. Call when problems with the map/tile view occure.

    Returns Promise<void>

  • Reinitialize the map.

    Takes an optional parameter of hylo-map-location components which will be used to render markers. If not provided, it looks for hylo-map-location components provided as child components.

    You might need to delay the call for a couple of milliseconds if you just added new locations to the component.

    Parameters

    • Optional locations: NodeListOf<HTMLHyloMapLocationElement>

    Returns Promise<void>

Events

hyloMapFullScreenOff: EventEmitter<any>

Fires when the map leaves the fullscreen mode.

hyloMapFullScreenOn: EventEmitter<HTMLElement>

Fires when the map switches into fullscreen. Emits the HTMLElement which wraps the fullscreen map.

hyloMapInitialised: EventEmitter<any>

Fires when the leaflet map is initialised. Emits the actual leaflet map object.

hyloMapReinitialised: EventEmitter<any>

Fires when the leaflet map is reinitialized. Emits the actual leaflet map object.

Generated using TypeDoc