@@ -8,6 +8,7 @@ import { ClarityIcons, layersIcon, mapIcon, compassIcon } from '@cds/core/icon';
88import { ClrVerticalNavModule , ClrStandaloneCdkTrapFocus , ClrNavigationModule , ClrIconModule } from '@clr/angular' ;
99import { LayerControlComponent , ProjectionSwitchComponent , MousePositionComponent , MapNavigatorComponent } from '@dlr-eoc/ngx-ukis-ui-clarity' ;
1010import { ExtentHelperComponent } from "../../components/extent-helper/extent-helper.component" ;
11+ import { delay } from 'rxjs/operators' ;
1112ClarityIcons . addIcons ( ...[ layersIcon , mapIcon , compassIcon ] ) ;
1213
1314@Component ( {
@@ -53,7 +54,17 @@ export class RouteMap2Component implements OnInit {
5354 units : 'm'
5455 }
5556
56- this . projections = [ EPSG_3857_Def , EPSG_3995_Def , EPSG_3031_Def , SwissCH1903 , ESRI_53034 ] ;
57+ const ETRS89_UTM_37N : IProjDef = {
58+ code : 'EPSG:25837' ,
59+ proj4js : '+proj=utm +zone=37 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs' ,
60+ title : 'UTM zone 37N' ,
61+ extent : [ - 4861198.58 , 3680548.11 , 489848.43 , 9660688.94 ] ,
62+ worldExtent : [ - 16.1 , 33.26 , 38.01 , 84.73 ] ,
63+ global : false ,
64+ units : 'm'
65+ }
66+
67+ this . projections = [ EPSG_3857_Def , EPSG_3995_Def , EPSG_3031_Def , SwissCH1903 , ESRI_53034 , ETRS89_UTM_37N ] ;
5768 this . addOverlays ( ) ;
5869 /**
5970 * set map extent or IMapState (zoom, center...) with the MapStateService
@@ -65,12 +76,11 @@ export class RouteMap2Component implements OnInit {
6576
6677
6778 ngOnInit ( ) : void {
68- this . mapStateSvc . getMapState ( ) . subscribe ( state => {
69- console . log ( 'MapState change' , state ) ;
70- } ) ;
71-
72- this . mapSvc . projectionChange . subscribe ( proj => {
79+ this . mapStateSvc . getProjection ( ) . pipe ( delay ( 300 ) ) . subscribe ( proj => {
7380 console . log ( 'Map Proj change' , proj ) ;
81+ if ( proj . epsg === 'EPSG:21781' ) {
82+ this . addLayer ( ) ;
83+ }
7484 } ) ;
7585 }
7686
@@ -137,10 +147,94 @@ export class RouteMap2Component implements OnInit {
137147 }
138148 ]
139149 } ,
140- visible : true
150+ visible : true ,
151+ bbox : [ 12.122762285148893 , 45.75982471322655 , 22.585503751196956 , 52.936158926509194 ]
152+ } ) ;
153+
154+ const vectorLayerPolar = new VectorLayer ( {
155+ id : 'geojson_test_PolarDEM' ,
156+ name : 'GeoJSON Vector Layer (PolarDEM)' ,
157+ type : 'geojson' ,
158+ data : {
159+ type : 'FeatureCollection' ,
160+ features : [
161+ {
162+ "type" : "Feature" ,
163+ "properties" : { } ,
164+ "geometry" : {
165+ "coordinates" : [
166+ [
167+ [
168+ - 56.610291493162265 ,
169+ - 63.14567134729959
170+ ] ,
171+ [
172+ - 65.55445992781995 ,
173+ - 65.42656926101324
174+ ] ,
175+ [
176+ - 73.57228421370289 ,
177+ - 70.01891446525254
178+ ] ,
179+ [
180+ - 79.9666203974736 ,
181+ - 72.86460180838449
182+ ] ,
183+ [
184+ - 83.04719665248149 ,
185+ - 74.13173444180848
186+ ] ,
187+ [
188+ - 55.69191893422601 ,
189+ - 75.70732872975574
190+ ] ,
191+ [
192+ - 59.942004469019835 ,
193+ - 72.39072889158679
194+ ] ,
195+ [
196+ - 61.35730570181974 ,
197+ - 67.91201652998802
198+ ] ,
199+ [
200+ - 56.610291493162265 ,
201+ - 63.14567134729959
202+ ]
203+ ]
204+ ] ,
205+ "type" : "Polygon"
206+ }
207+ }
208+ ]
209+ } ,
210+ visible : true ,
211+ bbox : [ - 85.02702775046276 , - 75.78913027273286 , - 49.34343400046277 , - 62.95113726720521 ] ,
212+ nativeBbox : {
213+ epsg : 'EPSG:3031' ,
214+ bbox : [ - 2788223.8152697003 , 180971.96438660682 , - 1093301.5018768182 , 1969824.701551262 ]
215+ }
141216 } ) ;
142217
143- const overlays = [ osm_layer , gufLayer , vectorLayer ] ;
218+ const TanDEMPolarDEM = new RasterLayer ( {
219+ type : 'wms' ,
220+ url : 'https://geoservice.dlr.de/eoc/elevation/wms' ,
221+ name : 'TanDEM-X PolarDEM Antarctica' ,
222+ id : 'TDM_POLARDEM90_ANT_HSC' ,
223+ params : {
224+ layers : 'TDM_POLARDEM90_ANT_HSC'
225+ } ,
226+ visible : false ,
227+ description : 'A hillshade generated from the TanDEM-X PolarDEM 90m elevation layer. This shading represents a combination slope and oblique shading.' ,
228+ attribution : 'PolarDEM Data © DLR/EOC licensed for <a href="https://geoservice.dlr.de/resources/licenses/polardem90/License_for_the_Utilization_of_TanDEM-X-PolarDEM_90m_for_Scientific_Use.pdf">scientific use</a>' ,
229+ legendImg : '' ,
230+ bbox : [ - 180 , - 90 , 180 , - 56.22686667234951 ] ,
231+ nativeBbox : {
232+ epsg : 'EPSG:3031' ,
233+ bbox : [ - 2699955 , - 2532555 , 2799855 , 2398455 ]
234+ }
235+ } )
236+
237+ const overlays = [ osm_layer , gufLayer , vectorLayer , TanDEMPolarDEM , vectorLayerPolar ] ;
144238 overlays . map ( layer => this . layersSvc . addLayer ( layer , 'Layers' ) ) ;
145239 }
146240
@@ -160,4 +254,70 @@ export class RouteMap2Component implements OnInit {
160254 this . mapStateSvc . setProjection ( proJ . code , 'user' , { fitToNativeBbox : nativeBbox } ) ;
161255 }
162256
257+ addLayer ( ) {
258+ const vectorLayerSwiss = new VectorLayer ( {
259+ id : 'geojson_test_Swiss' ,
260+ name : 'GeoJSON Vector Layer (Swiss)' ,
261+ type : 'geojson' ,
262+ data : {
263+ type : 'FeatureCollection' ,
264+ features : [
265+ {
266+ "type" : "Feature" ,
267+ "properties" : { } ,
268+ "geometry" : {
269+ "coordinates" : [
270+ [
271+ [
272+ 9.476989243125104 ,
273+ 47.48067255204134
274+ ] ,
275+ [
276+ 8.536024138082581 ,
277+ 47.36586953083
278+ ] ,
279+ [
280+ 7.229985139825061 ,
281+ 47.13551220276787
282+ ] ,
283+ [
284+ 6.119337802724459 ,
285+ 46.182699028304654
286+ ] ,
287+ [
288+ 6.926613876449522 ,
289+ 46.41361480319924
290+ ] ,
291+ [
292+ 8.07839630011074 ,
293+ 46.7458325561617
294+ ] ,
295+ [
296+ 9.333016440167455 ,
297+ 47.111021589561204
298+ ] ,
299+ [
300+ 9.476989243125104 ,
301+ 47.48067255204134
302+ ]
303+ ]
304+ ] ,
305+ "type" : "Polygon"
306+ }
307+ }
308+ ]
309+ } ,
310+ visible : true ,
311+ bbox : [ 6.121699327190461 , 46.05823590807236 , 9.496699327190466 , 47.5945721328394 ] ,
312+ nativeBbox : {
313+ epsg : 'EPSG:21781' ,
314+ bbox : [ 495592.4002543411 , 97816.18720803942 , 758272.4757513476 , 272596.3306093862 ]
315+ }
316+ } ) ;
317+
318+ if ( ! this . layersSvc . getLayerById ( vectorLayerSwiss . id ) ) {
319+ this . layersSvc . addLayer ( vectorLayerSwiss , 'Layers' ) ;
320+ }
321+ }
322+
163323}
0 commit comments