Global

Methods

defaultPopupTextProvider(element) → {string|undefined}

The default popup text provider, which tries its best to provide a description (in English) based on the tags of the element.
Parameters:
Name Type Description
element object The element returned by the Overpass API.
Properties
Name Type Description
tags object The tags of the element
Source:
Returns:
Type
string | undefined

focusOn(map, query, center)

Centers the map on something.
This will perform a search using Nominatim, and center the map on the first result. If no result is found, the coordinates are unchanged.
If the result of this function isn't satisfying, try to make a more specific query e.g. "Antwerpen Belgium", or simply set the coordinates manually.
The nominatim query will be performed using the following options:
  • limit=1
  • viewbox=current bounds (map.getBounds().toBBoxString())
  • format=json
  • q=query (the query string)

This function can be used even if the map has not been initialized yet. If that's the case, the parameter 'center' must be provided.
If you use this on the map returned by showMap, it has already be initialized so the center parameter is useless and can be omitted.
Parameters:
Name Type Description
map Leaflet.Map the Leaflet map
query string The nominatim query. Example "Antwerpen", "Brugge", etc.
center Leaflet.LatLng | undefined The center of the search. Must be provided if the map has not been initialized yet. If the map has been initialized, the bounds of its view will be used instead.
Source:

getSimpleQuery(key, value) → {string}

Returns a simple overpass query string that returns all nodes, ways and relations in the bbox that have a given key/value pair.
If key is undefined, all points will be returned. (Please be careful with the latter, if it's a large bbox, performance will be terrible, especially if you don't cap the number of features shown on screen)
Parameters:
Name Type Description
key string | undefined The key we're looking for
value string | undefined The value of the key we're looking for.
Source:
Returns:
the query string
Type
string

PopupTextProvider(element) → {string|undefined}

Parameters:
Name Type Description
element object The element returned by the Overpass API.
Properties
Name Type Description
tags object The tags of the element. Look for tags by checking if element.tags['yourTag'] is undefined or not.
Source:
Returns:
Type
string | undefined

queryAndShowFeatures(map, query, conf)

Queries the Overpass API and adds the resulting features to the map. This is asynchronous, the points will be added as soon as the API gives us a response.
Errors will be printed to the console if the query fails.
A warning will be printed to the console if some points are ignored due to the cap. (see Configuration.maxElements)
Parameters:
Name Type Description
map Leaflet.Map the map
query string the query. For generating simple queries, @see getSimpleQuery Note: occurences of {{bbox}} inside the query will be replaced with the bounds of the map.
conf Configuration | undefined the configuration object. Can be undefined to use the default configuration.
Source:

showMap(mapId, conf, focusQuery) → {Leaflet.Map}

Creates and displays a map in place of the div with id mapId.
If conf.canUseDivAttributes is set to true, this will call conf.useDivAttributes to update the configuration based on the attributes of the div (when present)
Parameters:
Name Type Description
mapId string The HTML id of the div that should become the map
conf Configuration the Configuration object. Can be undefined. If that's the case, a default-constructed object will be used. However, if you want to reuse the configuration object later, it's better to pass one.
focusQuery string | undefined If defined, calls focusOn to initialize the map using the focusQuery. Note that if this parameter is used, the focusOn attribute of the div will be ignored.
Source:
Returns:
The created Leaflet Map.
Type
Leaflet.Map