Browse Source

🚧 request featureInfo

jmacura 3 years ago
parent
commit
89f4a52ec3

+ 9 - 3
src/app/irrigation/irrigation-info.component.ts

@@ -1,10 +1,16 @@
-import {Component} from '@angular/core';
+// eslint-disable-next-line import/named
+import {Component, OnInit} from '@angular/core';
+import {IrrigationService} from './irrigation.service';
 
 @Component({
   selector: 'irrigation-info',
   templateUrl: './irrigation-info.component.html',
   styleUrls: ['../app.component.scss'],
 })
-export class IrrigationInfoComponent {
-  constructor() {}
+export class IrrigationInfoComponent implements OnInit {
+  constructor(private irrigationService: IrrigationService) {}
+
+  ngOnInit() {
+    this.irrigationService.getValues();
+  }
 }

+ 28 - 0
src/app/irrigation/irrigation.service.ts

@@ -4,4 +4,32 @@ import {Injectable} from '@angular/core';
 @Injectable({providedIn: 'root'})
 export class IrrigationService {
   constructor(private httpClient: HttpClient) {}
+
+  getValues() {
+    const params = {
+      'SERVICE': 'WMS',
+      'VERSION': '1.3.0',
+      'REQUEST': 'GetFeatureInfo',
+      'FORMAT': 'image/png',
+      'QUERY_LAYERS': 'water_surface_latest',
+      'LAYERS': 'water_surface_latest',
+      'INFO_FORMAT': 'text/plain',
+      'I': 100,
+      'J': 129,
+      'WIDTH': 256,
+      'HEIGHT': 256,
+      'CRS': 'EPSG:3857',
+      'STYLES': '',
+      'BBOX':
+        '2037505.4259696566,6130861.164697416,2038728.4184222193,6132084.157149979',
+    };
+    this.httpClient
+      .get('https://www.gis.atapex.sk/geoserver/agrihub/wms', {
+        params,
+        responseType: 'text',
+      })
+      .subscribe((data) => {
+        console.log(data);
+      });
+  }
 }