Skip to content

Commit

Permalink
Use map EPSG from the config
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Rusakov committed Nov 14, 2024
1 parent 2ff1a89 commit 987e1e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/app/_services/map.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,9 @@ export class MapService {
for (let i = 0; i < this.resolutions.length; i += 1) {
matrixIds.push(`${16 + i}`); // 16 is the first level of the WMTS
}
const EPSG = this.configService.config!.epsg || 'EPSG2056';
const bbox = baseMapConfig.boundingBoxWGS84;
const bounds = fromLonLat([bbox[0], bbox[1]], "EPSG:2056").concat(fromLonLat([bbox[2], bbox[3]], "EPSG:2056"));
const bounds = fromLonLat([bbox[0], bbox[1]], EPSG).concat(fromLonLat([bbox[2], bbox[3]], EPSG));
const tileGrid = new WMTSTileGrid({
origin: [bounds[0], bounds[3]],
resolutions: this.resolutions,
Expand Down Expand Up @@ -361,7 +362,7 @@ export class MapService {
register(proj4);
const config = this.configService.config!;
const initialBounds = config.basemaps[0].boundingBoxWGS84;
const bounds = fromLonLat([initialBounds[0], initialBounds[1]], "EPSG:2056").concat(fromLonLat([initialBounds[2], initialBounds[3]], "EPSG:2056"));
const bounds = fromLonLat([initialBounds[0], initialBounds[1]], EPSG).concat(fromLonLat([initialBounds[2], initialBounds[3]], EPSG));
this.resolutions = this.configService.config.resolutions;
this.projection = new Projection({
code: EPSG,
Expand Down
5 changes: 3 additions & 2 deletions src/assets/configs/config.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,23 @@
],
"resolutions": [250, 100, 50, 20, 10, 5, 2.5, 2, 1.5, 1, 0.5, 0.25, 0.125, 0.0625],
"epsg": "EPSG:2056",
"boundingBoxWGS84": [11.47757, 48.230651, 5.140242, 45.398181],
"basemaps": [
{
"id": "ch.swisstopo.pixelkarte-farbe",
"label": "Landeskarten (farbig)",
"description": "Landeskarten (farbig)",
"thumbUrl": "assets/images/planville.png",
"matrixSet": "2056",
"format": "jpeg"
"format": "jpeg",
"boundingBoxWGS84": [5.140242, 45.398181, 11.47757, 48.230651]
},{
"id": "ch.swisstopo.pixelkarte-grau",
"label": "Karte Grau",
"description": "Karte Grau",
"thumbUrl": "assets/images/cadastre.png",
"matrixSet": "2056",
"format": "jpeg",
"boundingBoxWGS84": [5.140242, 45.398181, 11.47757, 48.230651]
}
],
"pageformats": [
Expand Down

0 comments on commit 987e1e5

Please sign in to comment.