# UN Topo Base Map

A reference Leaflet basemap implementation using the **UN Geospatial ClearMap WebTopo** tile service — the official UN basemap used across UN.org web properties.

## Hosted URL

```
https://assets.undrr.org/projects/maps/un-topo-base-map/v1/map-reference.html
```

## What this provides

A standalone reference HTML file (`v1/map-reference.html`) demonstrating how to initialise a Leaflet map using the UN Geospatial tile service as the basemap. Unlike the `simple-base-map`, this approach:

- Requires **no bundled GeoJSON assets** — tiles are fetched directly from `geoservices.un.org`
- Renders a **photorealistic topographic** world map with country labels, terrain shading, and coastlines
- Loads faster on first render (no 500 KB GeoJSON parse step)

ClearMap tiles only go to zoom 6. For subnational, city or street-level maps, use the [UN Street Map](../un-street-map/README.md), a vector basemap with detail at every zoom level.

## Tile URL

```
https://geoservices.un.org/arcgis/rest/services/ClearMap_WebTopo/MapServer/tile/{z}/{y}/{x}
```

> **Note:** The ArcGIS REST tile convention uses `{z}/{y}/{x}` (y before x), which is the **reverse** of the standard Leaflet `{z}/{x}/{y}` order. The URL above is correct for this service.

## Minimal usage

```html
<link rel="stylesheet" href="https://assets.undrr.org/projects/leaflet/1.9.4/leaflet.css" />
<script src="https://assets.undrr.org/projects/leaflet/1.9.4/leaflet.js"></script>

<div id="map" style="height: 400px;"></div>

<script>
  const map = L.map('map').setView([20, 0], 2);

  L.tileLayer(
    'https://geoservices.un.org/arcgis/rest/services/ClearMap_WebTopo/MapServer/tile/{z}/{y}/{x}'
  ).addTo(map);
</script>
```

## Attribution

All maps using this tile service must include:

```
Base map: <a href="https://www.un.org/geospatial/">UN Geospatial</a>
```

The UN boundary disclaimer text is also required on all published maps — see the reference HTML for the full text.

## Comparison with `simple-base-map`

| | `simple-base-map` | `un-topo-base-map` |
|---|---|---|
| Basemap source | Bundled GeoJSON (map-assets.js, ~500 KB) | Remote tile service |
| Appearance | Minimal wireframe outlines | Full UN topo with labels and terrain |
| Works offline | Yes (once assets load) | No |
| Zoom support | Fixed world view | Full zoom range supported |
| Asset required | `map-assets.js` | None (tiles only) |

## Versions

### v1 (current)

- Initial reference implementation
- Tile layer: `ClearMap_WebTopo` from `geoservices.un.org`
- Sample dot markers using coordinates from `simple-base-map/v1/map-assets.js`
