# External map layer

<figure><img src="/files/BJDt1WrPdZbv3brKZpsj" alt=""><figcaption><p>In Map settings >> External layer</p></figcaption></figure>

{% hint style="success" %}
sample map with swiss topo layer: <https://racemap.com/player/swiss-topo-sample>

URL to call external layer: <https://wms.geo.admin.ch/?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&LAYERS=ch.swisstopo.swissimage&STYLES=default&CRS=EPSG:3857&BBOX={bbox-epsg-3857}&WIDTH=256&HEIGHT=256&FORMAT=image/png>

more about swiss topo. <https://www.geo.admin.ch/en/geo-services/geo-services/portrayal-services-web-mapping/web-map-services-wms.html>&#x20;
{% endhint %}

```
https://wms.geo.admin.ch/
     ?SERVICE=WMS
     &REQUEST=GetMap
     &VERSION=1.3.0
     &LAYERS=ch.swisstopo.swissimage
     &STYLES=default
     &CRS=EPSG:3857
     &BBOX={bbox-epsg-3857}
     &WIDTH=256
     &HEIGHT=256
     &FORMAT=image/png
```

|                            |                                     |
| -------------------------- | ----------------------------------- |
| SERVICE                    | WMS                                 |
| REQUEST                    | GetMap                              |
| VERSION                    | 1.3.0 or 1.1.0                      |
| STYLES                     | empty                               |
| CRS (1.3.0) or SRS (1.1.0) | EPSG:3857                           |
| BBOX                       | {bbox-epsg-3857} a variable         |
| WIDTH                      | 256; same as tile size respectively |
| HEIGHT                     | 256; same as tile size respectively |
| FORMAT                     | image/png or image/jpeg             |
| TRANSPARENT                | true                                |

LAYERS: different, available in GetCapabilities e.g. <https://wxs.ign.fr/`yourkey`/geoportail/r/wms?SERVICE=WMS\\&VERSION=1.3.0\\&REQUEST=GetCapabilities>

### Use GeoTIFF

{% file src="/files/YisBIpkK4t0DCYG36i5v" %}
Download the sample file GeoTiff
{% endfile %}

1. mapbox style editor \
   "Create a style" and "Start from scratch"

   <figure><img src="/files/yv2IQIG4pPXjLbGnkqKj" alt=""><figcaption></figcaption></figure>
2. Add a "Custom layer" and upload the GeoTIFF or KML file.&#x20;

   <figure><img src="/files/xG6k5ANBbNp5V2mARTQI" alt=""><figcaption></figcaption></figure>
3. mapbox creates the layer ID once the GeofTIFF is uploaded \
   `racemap.48p1az6b` <br>

   <figure><img src="/files/j4aE3nStUstyXSOqdJqR" alt=""><figcaption></figcaption></figure>
4. RACEMAP >> Map Settings >> External Layers \
   Add URL as external WMS: `https://api.mapbox.com/v4/racemap.48p1az6b/{z}/{x}/{y}.png?access_token={privateKeyMapbox}` and replace `{privateKeyMapbox}` with your mapbox key.&#x20;

   <figure><img src="/files/phdpn4k5F9Pq207GlkKE" alt=""><figcaption></figcaption></figure>

The result shows the original TIFF file: <https://racemap.com/player/6a01a8d5bd1f6d9fc6f4f50d>&#x20;

#### Remove the border in the GeoTIFF

1. Free download of [QGIS](https://qgis.org/)&#x20;
2. Load GeoTIFF and create a new GeoPackage-layer

   <figure><img src="/files/rusLQX8XqUYlpgQO3Axu" alt=""><figcaption></figcaption></figure>
3. Select "Polygon"\
   ![](/files/Zb2PcpuPkwzgnsYkoEgY)
4. Define borders with the pencil and polygon tool - left click: add point, right click: finish polygon.&#x20;

   <figure><img src="/files/GwvMVrcUdOhbwJYHiLmD" alt=""><figcaption></figcaption></figure>
5. Raster >> Extraction >> Clip Raster by Mask Layer: Data outside the polygon is removed.

<figure><img src="/files/Ba5BVy8H2K3Wzq1S6Xp4" alt=""><figcaption></figcaption></figure>

6. Select the GeoTIFF as the input file, the mask layer to use (previously created), enable "Create an output alpha band" and "Keep resolution of input raster".

   <figure><img src="/files/Ixm2UFP4pxbhGaM2aVuy" alt=""><figcaption></figcaption></figure>

   6\. QGIS generates a new GeoTIFF file, which you now use to create another mapbox layer.\
   ![](/files/D2lXFXupPHqNGwcKHUWc)

Sample: <https://racemap.com/player/external-layer-mask/>&#x20;

{% hint style="info" %}
We needed to run "Fix Geometries" in QGIS before extraction processed successfully.&#x20;
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.racemap.com/tab-map/external-map-layer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
