Ver Fonte

✨ add LPIS layer

jmacura há 3 anos atrás
pai
commit
4d5fede8c4
1 ficheiros alterados com 36 adições e 0 exclusões
  1. 36 0
      src/app/app.component.ts

+ 36 - 0
src/app/app.component.ts

@@ -3,8 +3,10 @@ import {Component} from '@angular/core';
 import proj4 from 'proj4';
 import {GeoJSON} from 'ol/format';
 import {OSM, Vector as VectorSource} from 'ol/source';
+import {Stroke, Style} from 'ol/style';
 import {Tile, Vector as VectorLayer} from 'ol/layer';
 import {View} from 'ol';
+import {bbox as bboxStrategy} from 'ol/loadingstrategy';
 import {get as getProjection, transform} from 'ol/proj';
 import {register} from 'ol/proj/proj4';
 
@@ -72,6 +74,20 @@ export class AppComponent {
         </NamedLayer>
       </StyledLayerDescriptor>
     `;
+    const lpisSource = new VectorSource({
+      format: new GeoJSON({
+        dataProjection: 'EPSG:5514',
+      }),
+      url: (extent) => {
+        console.log(extent);
+        // eslint-disable-next-line prettier/prettier
+        return `http://localhost:8085/https://gis.lesprojekt.cz/cgi-bin/mapserv?map=/home/dima/maps/foodie/lpis.map&service=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=lpis_cultures&SRSNAME=EPSG:5514&outputformat=geojson&COUNT=100&%3Cogc:Filter%20xmlns:ogc=%22http://www.opengis.net/ogc%22%3E%3Cogc:PropertyIsEqualTo%3E%3Cogc:PropertyName%3Ekulturakod%3C/ogc:PropertyName%3E%3Cogc:Literal%3E2%3C/ogc:Literal%3E%3C/ogc:PropertyIsEqualTo%3E%3Cgml:Box%3E%3Cgml:coordinates%3E${
+          extent.join(',')
+          // eslint-disable-next-line prettier/prettier
+        }%3C/gml:coordinates%3E%3C/gml:Box%3E%3C/ogc:Filter%3E`;
+      },
+      strategy: bboxStrategy,
+    });
     /* Define and update the HsConfig configuration object */
     this.hsConfig.update({
       datasources: [
@@ -149,6 +165,26 @@ export class AppComponent {
           },
           source: this.fieldService.fields,
         }),
+        new VectorLayer({
+          properties: {
+            title: 'LPIS',
+            synchronize: false,
+            cluster: false,
+            inlineLegend: true,
+            editor: {
+              editable: false,
+            },
+            //sld: fieldSld,
+            //path: 'User generated',
+          },
+          source: lpisSource,
+          style: new Style({
+            stroke: new Stroke({
+              color: 'rgba(0, 0, 255, 1.0)',
+              width: 2,
+            }),
+          }),
+        }),
       ],
       translationOverrides: i18n,
     });