### JavaScript for Dynamic Link Generation Source: https://api3.geo.admin.ch/_sources/api/examples.rst This script processes a configuration array to dynamically generate lists of links to mapping examples. It maps 'codepen' IDs to full CodePen URLs and appends them to specific HTML elements based on category, enabling interactive display of example collections. ```javascript var conf = [{ label: 'Map with overlay layer', codepen: 'qbeqPQ', cat: 0 }, { label: 'Map with KML file overlay', codepen: 'eJqBVV', cat: 0 }, { label: 'Geocoder', codepen: 'JGgzQG', cat: 0 }, { label: 'Rectangle selection', codepen: 'NxQmvo', cat: 0 }, { label: 'Searchbox', codepen: 'xZvNEY', cat: 0 }, { label: 'Catalog', codepen: 'grYLdY', cat: 0 }, { label: 'Localisation', codepen: 'GZKrem', cat: 0 }, { label: 'GeoJSON integration', codepen: 'ZWzXgv', cat: 0 }, { label: 'WMTS and WMS in swiss projection (EPSG:21781)', codepen: 'xVKLdV', cat: 1 }, { label: 'WMTS in Pseudo-Mercator projection (EPSG:3857)', codepen: 'pyzwwL', cat: 1 }, { label: 'WMTS in LV95 (EPSG:2056)', codepen: 'GZKEam', cat: 1 }, { label: 'All available layers as WMTS', codepen: 'MyYYXR', cat: 1 }, { label: 'Most simple example using vanilla OL6', link: 'https://codesandbox.io/s/geoadmin-with-vanilla-openlayers-z3dij', cat: 2 }, { label: 'Using WMTS and WMS together in OL6', link: 'https://codesandbox.io/s/vanilla-openlayers-with-a-wms-layer-06h77', cat: 2 }, { label: 'More OpenLayers 6 Examples on the official website.', link: 'https://openlayers.org/en/v6.5.0/examples/', cat: 2 }, { label: 'Feature selection of KML and GeoJSON layers', codepen: 'yOBzqM', cat: 3 }, { label: 'Geoadmin Terrain and WMTS CesiumJS integration', codepen: 'zBEYGE', cat: 4 }, { label: 'WMTS in EPSG:3857 using Leaflet', codepen: 'grGOLV', cat: 5 }, { label: 'WMS in EPSG:3857 using Leaflet', codepen: 'JKAjWk', cat: 5 }, { label: 'Mapbox vectortiles example', codepen: 'GvgLvj', cat: 5 }]; var tpl = '
  • {label}
  • '; var cat1 = '', cat2 = '', cat3 = '', cat4 = '', cat5 = ''; conf.forEach(function(item) { if (item.codepen) { item.link = '//codepen.io/geoadmin/pen/' + item.codepen + '?editors=0010'; } var link = tpl.replace('{link}', item.link).replace('{label}', item.label); switch(item.cat) { default: break; case 1: cat1 += link; break; case 2 : cat2 += link; break; case 3: cat3 += link; break; case 4: cat4 += link; break; case 5: cat5 += link; break; }; }); document.getElementById('cat1').innerHTML = cat1; document.getElementById('cat2').innerHTML = cat2; document.getElementById('cat3').innerHTML = cat3; document.getElementById('cat4').innerHTML = cat4; document.getElementById('cat5').innerHTML = cat5; ``` -------------------------------- ### Vectortiles Configuration Examples Source: https://api3.geo.admin.ch/releasenotes/index Examples of URLs pointing to vectortile configurations and styles, commonly used for map rendering and data access in web mapping applications. ```JSON // Vectortiles set "base" // https://vectortiles.geo.admin.ch/tiles/ch.swisstopo.base.vt/v1.0.0/tiles.json ``` ```JSON // Base Map Style // https://vectortiles.geo.admin.ch/styles/ch.swisstopo.basemap.vt/style.json ``` ```JSON // Light Base Map Style // https://vectortiles.geo.admin.ch/styles/ch.swisstopo.lightbasemap.vt/style.json ``` ```JSON // Imagery Base Map Style // https://vectortiles.geo.admin.ch/styles/ch.swisstopo.imagerybasemap.vt/style.json ``` -------------------------------- ### OpenLayers Example Links Source: https://api3.geo.admin.ch/services/sdiservices Links to external CodePen examples demonstrating the use of Geo Admin CH services with OpenLayers. These examples showcase specific functionalities like Cadastralwebmap as WMTS or Swissimage as XYZ. ```OpenLayers http://codepen.io/geoadmin/pen/pyzwwL?editors=0010 http://codepen.io/geoadmin/pen/xVKLdV?editors=0010 http://codepen.io/geoadmin/pen/GZKEam?editors=0010 http://codepen.io/geoadmin/pen/MyYYXR?editors=0010 https://codepen.io/geoadmin/pen/xxYEwjQ ``` -------------------------------- ### GeoAdmin API MapServer Endpoint Examples Source: https://api3.geo.admin.ch/_sources/services/sdiservices.rst Provides examples of common API requests to the GeoAdmin MapServer, including listing all layers, searching by text, and finding layers by GeoCat ID. ```APIDOC API: GeoAdmin MapServer Base URL: https://api3.geo.admin.ch/rest/services/api/MapServer Methods: 1. **List all layers** * **Description**: Retrieves a list of all available layers in the GeoAdmin API. * **URL**: `GET /rest/services/api/MapServer` * **Parameters**: None * **Returns**: JSON object containing layer information. * **Example**: `https://api3.geo.admin.ch/rest/services/api/MapServer` 2. **Find layers by text search** * **Description**: Searches for layers where the specified text appears in their description or name. * **URL**: `GET /rest/services/api/MapServer` * **Parameters**: * `searchText` (string, optional): The text to search for within layer descriptions. * **Returns**: JSON object containing matching layer information. * **Example**: `https://api3.geo.admin.ch/rest/services/api/MapServer?searchText=wasser` 3. **Find layer by GeoCat ID** * **Description**: Retrieves information for a specific layer using its unique GeoCat metadata identifier. * **URL**: `GET /rest/services/api/MapServer` * **Parameters**: * `searchText` (string, required): The GeoCat ID of the layer to find. * **Returns**: JSON object containing the specific layer's information. * **Example**: `https://api3.geo.admin.ch/rest/services/api/MapServer?searchText=f198f6f6-8efa-4235-a55f-99767ea0206c` 4. **Get Layer Attributes by BOD ID** * **Description**: Exposes the attribute names specific to a layer, identified by its BOD ID. Useful when combined with the find service. * **URL**: `GET /rest/services/api/MapServer/{layerBodId}` * **Parameters**: * `layerBodId` (string, required): The technical name or BOD ID of the layer. * `lang` (string, optional): The language for the response. Supported values: de, fr, it, rm, en. Defaults to 'de'. * **Returns**: JSON object detailing the layer's attributes. * **Example**: `https://api3.geo.admin.ch/rest/services/api/MapServer/ch.bfs.gebaeude_adresse.gebaeude` ``` -------------------------------- ### Example XYZ Tile URL Source: https://api3.geo.admin.ch/services/sdiservices An example URL for fetching a JPEG tile from the Swissimage layer using the XYZ tile service. It demonstrates the structure with specific values for projection, zoom, and tile coordinates. ```APIDOC https://wmts.geo.admin.ch/1.0.0/ch.swisstopo.swissimage/default/current/3857/{z}/{x}/{y}.jpeg ``` -------------------------------- ### XYZ GetTile Request Parameters Source: https://api3.geo.admin.ch/services/sdiservices Details the parameters required for a GET request to the XYZ tile service. It specifies the meaning and example values for Scheme, ServerName, Version, Layername, StyleName, Time, TileMatrixSet, and format extension. ```APIDOC GET ://////