User:Kannix/brouter/vector-tiles

From OpenStreetMap Wiki
Jump to navigation Jump to search

aim

inject vector-tile-layer to brouter-web-client

hack

edit .../brouter.grade.de/index.html and add to end of <body> section:

       <link href="https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css" rel='stylesheet' />
       <script src="https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js"></script>
       <script src="https://maps.grade.de/leaflet/leaflet-maplibre-gl.js"></script>

edit .../brouter.grade.de/dist/brouter-web.js and extend BR.Map = object:

 var gl = L.maplibreGL({
   style: 'https://maps.grade.de/maplibre/style.json',
   attribution: 'Map data:  © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, under ODbL | Tiles: © <a href="https://maps.grade.de">maps.grade.de</a>',
   pane: 'overlayPane'
 });
 l[i18next.t("CEMT (Vector-2021)")] = gl;
 l[i18next.t("CEMT (Vector-2021)")].id = 'CEMT';

preview

https://brouter.grade.de/#map=5/54.618/23.533/CARTO,CEMT