Skip to main content

Map component

The docs show GeoJSON on a map with the component <en-geo-map>. The GeoJSON is the content of a <script type="application/geo+json"> inside of the component, written like the JSON of the graph component. The markdown version of the page contains the GeoJSON as a json geo-map code block.

<en-geo-map>
<script type="application/geo+json">{`
{ "type": "Point", "coordinates": [13.3777, 52.5163] }
`}</script>
</en-geo-map>

The GeoJSON can be a geometry (including a GeometryCollection), a Feature or a FeatureCollection. Altitudes are ignored. Features with the property "hl": "query" are drawn in the highlight color, e.g. the position a search started from. Invalid GeoJSON is shown as an error message instead of the map.

Attributes

AttributeDefaultDescription
height360pxCSS height of the map.
max-zoom12Highest zoom level when the view is fitted to the data, so that a point is not shown up close.
fit-padding40Space around the data when the view is fitted to it, in pixels.
popupsoffA click on a feature shows its properties.
interactivetruefalse shows a static map, without controls.

The map can be moved and zoomed, but not rotated or tilted. Scrolling the page over a map scrolls the page; zooming needs the control key or two fingers. The button below the zoom buttons fits the view to all features again.

Basemap

The basemap uses the “muted” style of VersaTiles and follows the light or dark mode of the system. Tiles come from tiles.versatiles.org. When it can’t be reached, the maps show zoom levels 0 to 5 (in Germany 0 to 8) from a file which is part of the docs (/basemap/, built by docs/scripts/build-basemap.mjs), together with the fonts and icons of the style.

Examples

Point

MultiPoint

LineString

MultiLineString

Polygon

A polygon with a hole:

MultiPolygon

GeometryCollection

FeatureCollection

Features with "hl": "query" are highlighted; this map has popups:

Static map