Skip to content

Commit 1fd9889

Browse files
committed
refactor: demo-maps projection example and add new projection for Swiss
1 parent a18fa25 commit 1fd9889

3 files changed

Lines changed: 26 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@
2424
### Bug Fixes
2525
* **@dlr-eoc/map-maplibre:**
2626
- Fix type errors on `setData` and test for string if kml.
27+
- Replaced `TypedStyleLayer` with `StyleLayer` because `TypedStyleLayer` is not exported anymore.
2728

2829
* **@dlr-eoc/ngx-ukis-ui-clarity:**
2930
- Add missing code for `<ngx-ukis-global-alert>`, `<ngx-ukis-global-progress>` and `<ngx-ukis-header>`. This was lost by the conversion from `@dlr-eoc/core-ui` to `@dlr-eoc/ngx-ukis-ui-clarity`.
3031

31-
* **@dlr-eoc/map-maplibre:**
32-
- Replaced `TypedStyleLayer` with `StyleLayer` because `TypedStyleLayer` is not exported anymore.
33-
3432
* **@dlr-eoc/services-ogc:**
3533
* **@dlr-eoc/utils-ogc:**
3634
* **@dlr-eoc/demo-maps:**

projects/demo-maps/src/app/route-components/route-example-projection/route-map2.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
<cds-icon shape="map" clrVerticalNavIcon></cds-icon>
1515
Projection
1616
<clr-vertical-nav-group-children class="padding title-ellipsis">
17+
On change, the map will fit to the new Projection extent. See "fitViewToNewExtent" Input
18+
<p></p>
1719
<ukis-projection-switch [mapSvc]="mapSvc" [projectionList]="projections" [fitViewToNewExtent]="true"></ukis-projection-switch>
1820
</clr-vertical-nav-group-children>
1921
</clr-vertical-nav-group>

projects/demo-maps/src/app/route-components/route-example-projection/route-map2.component.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,35 @@ export class RouteMap2Component implements OnInit {
6262
units: 'm'
6363
};
6464

65-
this.projections = [webMercator, arcticPolarStereographic, antarcticPolarStereographic];
65+
const SwissCH1903: IProjDef = {
66+
code: `EPSG:21781`,
67+
proj4js: '+proj=somerc +lat_0=46.9524055555556 +lon_0=7.43958333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs +type=crs',
68+
title: 'Swiss CH1903 / LV03',
69+
extent: [484273.3, 73150.16, 837939.88, 299970.97],
70+
worldExtent: [5.95, 45.81, 10.5, 47.81],
71+
global: false,
72+
units: 'm'
73+
};
74+
75+
this.projections = [webMercator, arcticPolarStereographic, antarcticPolarStereographic, SwissCH1903];
6676
this.addOverlays();
67-
/** set map extent or IMapState (zoom, center...) with the MapStateService */
68-
this.mapStateSvc.setExtent([-14, 33, 40, 57]);
77+
/**
78+
* set map extent or IMapState (zoom, center...) with the MapStateService
79+
* Check if the Extent is valid for the set projection.
80+
*/
81+
this.mapStateSvc.setExtent([-14, 33, 40, 57]);
6982

7083
}
7184

7285

7386
ngOnInit(): void {
87+
this.mapStateSvc.getMapState().subscribe(state => {
88+
console.log('MapState change', state);
89+
});
90+
91+
this.mapSvc.projectionChange.subscribe(proj => {
92+
console.log('Map Proj change', proj);
93+
});
7494
}
7595

7696
addOverlays() {

0 commit comments

Comments
 (0)