API version: 0.3.0

---

# 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.

```mdx
<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

| Attribute     | Default | Description                                                                                    |
| ------------- | ------- | ---------------------------------------------------------------------------------------------- |
| `height`      | `360px` | CSS height of the map.                                                                         |
| `max-zoom`    | `12`    | Highest zoom level when the view is fitted to the data, so that a point is not shown up close. |
| `fit-padding` | `40`    | Space around the data when the view is fitted to it, in pixels.                                |
| `popups`      | off     | A click on a feature shows its properties.                                                     |
| `interactive` | `true`  | `false` 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](https://versatiles.org) 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

```json geo-map
{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [
      13.3777,
      52.5163
    ]
  },
  "properties": {
    "name": "Brandenburg Gate"
  }
}
```

### MultiPoint

```json geo-map
{
  "type": "MultiPoint",
  "coordinates": [
    [
      13.3777,
      52.5163
    ],
    [
      13.3762,
      52.5186
    ],
    [
      13.3904,
      52.5075
    ]
  ]
}
```

### LineString

```json geo-map
{
  "type": "LineString",
  "coordinates": [
    [
      13.3777,
      52.5163
    ],
    [
      13.3904,
      52.5075
    ],
    [
      13.4094,
      52.5208
    ]
  ]
}
```

### MultiLineString

```json geo-map
{
  "type": "MultiLineString",
  "coordinates": [
    [
      [
        13.37,
        52.51
      ],
      [
        13.39,
        52.51
      ]
    ],
    [
      [
        13.37,
        52.52
      ],
      [
        13.39,
        52.52
      ]
    ]
  ]
}
```

### Polygon

A polygon with a hole:

```json geo-map
{
  "type": "Polygon",
  "coordinates": [
    [
      [
        13.37,
        52.5
      ],
      [
        13.42,
        52.5
      ],
      [
        13.42,
        52.53
      ],
      [
        13.37,
        52.53
      ],
      [
        13.37,
        52.5
      ]
    ],
    [
      [
        13.385,
        52.505
      ],
      [
        13.395,
        52.505
      ],
      [
        13.395,
        52.51
      ],
      [
        13.385,
        52.51
      ],
      [
        13.385,
        52.505
      ]
    ]
  ]
}
```

### MultiPolygon

```json geo-map
{
  "type": "MultiPolygon",
  "coordinates": [
    [
      [
        [
          13.37,
          52.5
        ],
        [
          13.39,
          52.5
        ],
        [
          13.39,
          52.52
        ],
        [
          13.37,
          52.52
        ],
        [
          13.37,
          52.5
        ]
      ]
    ],
    [
      [
        [
          13.4,
          52.5
        ],
        [
          13.42,
          52.5
        ],
        [
          13.42,
          52.52
        ],
        [
          13.4,
          52.52
        ],
        [
          13.4,
          52.5
        ]
      ]
    ]
  ]
}
```

### GeometryCollection

```json geo-map
{
  "type": "GeometryCollection",
  "geometries": [
    {
      "type": "Point",
      "coordinates": [
        13.3777,
        52.5163
      ]
    },
    {
      "type": "LineString",
      "coordinates": [
        [
          13.37,
          52.51
        ],
        [
          13.4,
          52.52
        ]
      ]
    },
    {
      "type": "Polygon",
      "coordinates": [
        [
          [
            13.38,
            52.5
          ],
          [
            13.41,
            52.5
          ],
          [
            13.41,
            52.51
          ],
          [
            13.38,
            52.5
          ]
        ]
      ]
    }
  ]
}
```

### FeatureCollection

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

```json geo-map
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          13.3777,
          52.5163
        ]
      },
      "properties": {
        "name": "query",
        "hl": "query"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          13.3762,
          52.5186
        ]
      },
      "properties": {
        "name": "Reichstag Building"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          13.3904,
          52.5075
        ]
      },
      "properties": {
        "name": "Checkpoint Charlie"
      }
    }
  ]
}
```

### Static map

```json geo-map
{
  "type": "Point",
  "coordinates": [
    2.2945,
    48.8584
  ]
}
```

---

Home: [Ember Nexus API docs](/index.md)

Full site map: [llms.txt](/llms.txt)
