|
@@ -4,10 +4,10 @@ import proj4 from 'proj4';
|
|
|
import {GeoJSON} from 'ol/format';
|
|
import {GeoJSON} from 'ol/format';
|
|
|
import {OSM, TileWMS, Vector as VectorSource} from 'ol/source';
|
|
import {OSM, TileWMS, Vector as VectorSource} from 'ol/source';
|
|
|
import {Tile, Vector as VectorLayer} from 'ol/layer';
|
|
import {Tile, Vector as VectorLayer} from 'ol/layer';
|
|
|
-import {View} from 'ol';
|
|
|
|
|
import {bbox as bboxStrategy} from 'ol/loadingstrategy';
|
|
import {bbox as bboxStrategy} from 'ol/loadingstrategy';
|
|
|
import {get as getProjection, transform} from 'ol/proj';
|
|
import {get as getProjection, transform} from 'ol/proj';
|
|
|
import {register} from 'ol/proj/proj4';
|
|
import {register} from 'ol/proj/proj4';
|
|
|
|
|
+import {transformExtent} from 'ol/proj';
|
|
|
|
|
|
|
|
import {
|
|
import {
|
|
|
HsConfig,
|
|
HsConfig,
|
|
@@ -15,11 +15,13 @@ import {
|
|
|
HsLanguageService,
|
|
HsLanguageService,
|
|
|
HsLayerManagerService,
|
|
HsLayerManagerService,
|
|
|
HsLayoutService,
|
|
HsLayoutService,
|
|
|
|
|
+ HsMapService,
|
|
|
HsPanelContainerService,
|
|
HsPanelContainerService,
|
|
|
|
|
+ HsQueryVectorService,
|
|
|
HsSidebarService,
|
|
HsSidebarService,
|
|
|
|
|
+ getTitle,
|
|
|
} from 'hslayers-ng';
|
|
} from 'hslayers-ng';
|
|
|
|
|
|
|
|
-import i18n from './translations.json';
|
|
|
|
|
import {FcCalculatorService} from './calculator/calculator.service';
|
|
import {FcCalculatorService} from './calculator/calculator.service';
|
|
|
import {imageWmsTLayer} from './calculator/image-wms-t-layer';
|
|
import {imageWmsTLayer} from './calculator/image-wms-t-layer';
|
|
|
|
|
|
|
@@ -44,8 +46,12 @@ export class AppService {
|
|
|
public hsLayerManagerService: HsLayerManagerService,
|
|
public hsLayerManagerService: HsLayerManagerService,
|
|
|
public hsLayoutService: HsLayoutService,
|
|
public hsLayoutService: HsLayoutService,
|
|
|
public hsPanelContainerService: HsPanelContainerService,
|
|
public hsPanelContainerService: HsPanelContainerService,
|
|
|
- public hsSidebarService: HsSidebarService
|
|
|
|
|
- ) {
|
|
|
|
|
|
|
+ public hsSidebarService: HsSidebarService,
|
|
|
|
|
+ private hsMapService: HsMapService,
|
|
|
|
|
+ private hsQueryVectorService: HsQueryVectorService
|
|
|
|
|
+ ) {}
|
|
|
|
|
+
|
|
|
|
|
+ init(): void {
|
|
|
/* Define the polygon's style using SLD */
|
|
/* Define the polygon's style using SLD */
|
|
|
const fieldSld = `<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
const fieldSld = `<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
|
<StyledLayerDescriptor version="1.0.0"
|
|
<StyledLayerDescriptor version="1.0.0"
|
|
@@ -80,8 +86,14 @@ export class AppService {
|
|
|
const lpisSource = new VectorSource({
|
|
const lpisSource = new VectorSource({
|
|
|
format: new GeoJSON({
|
|
format: new GeoJSON({
|
|
|
dataProjection: 'EPSG:5514',
|
|
dataProjection: 'EPSG:5514',
|
|
|
|
|
+ featureProjection: this.hsMapService.getCurrentProj('default'),
|
|
|
}),
|
|
}),
|
|
|
url: (extent) => {
|
|
url: (extent) => {
|
|
|
|
|
+ if (extent == undefined) {
|
|
|
|
|
+ extent = this.hsMapService.getMapExtent('default');
|
|
|
|
|
+ }
|
|
|
|
|
+ const cur_proj = this.hsMapService.getCurrentProj('default');
|
|
|
|
|
+ extent = transformExtent(extent, cur_proj, 'EPSG:5514');
|
|
|
const kulturaKod = 1; // Doesn't seem to work
|
|
const kulturaKod = 1; // Doesn't seem to work
|
|
|
const proxyPath = window.location.hostname.includes('localhost')
|
|
const proxyPath = window.location.hostname.includes('localhost')
|
|
|
? 'http://localhost:8085/'
|
|
? 'http://localhost:8085/'
|
|
@@ -203,6 +215,67 @@ export class AppService {
|
|
|
}),
|
|
}),
|
|
|
];*/
|
|
];*/
|
|
|
/* Define and update the HsConfig configuration object */
|
|
/* Define and update the HsConfig configuration object */
|
|
|
|
|
+ const translationOverrides = this.hsConfig.get().translationOverrides ?? {};
|
|
|
|
|
+ const mergedTranslationOverrides = {
|
|
|
|
|
+ ...translationOverrides,
|
|
|
|
|
+ ...{
|
|
|
|
|
+ 'cs': {
|
|
|
|
|
+ 'CALCULATOR': {
|
|
|
|
|
+ 'blurNone': 'žádné',
|
|
|
|
|
+ 'getDates': 'VYBRAT DATUM',
|
|
|
|
|
+ 'getZones': 'ZÍSKAT ZÓNY',
|
|
|
|
|
+ 'errorLoading': 'Chyba při načítání dat',
|
|
|
|
|
+ 'errorLoadingDates':
|
|
|
|
|
+ 'Nebylo možné načíst seznam možných dat ze serveru. Zkuste to prosím později.',
|
|
|
|
|
+ 'errorLoadingZones':
|
|
|
|
|
+ 'Nebylo možné načíst zóny pole ze serveru. Pravděpodobně z důvodu přílišné oblačnosti snímku. Zkuste jiný datum.',
|
|
|
|
|
+ 'loading': 'Načítám',
|
|
|
|
|
+ 'panelHeader': 'Výpočet indexů pole',
|
|
|
|
|
+ 'selectBlur': 'Vyhlazení hran zón',
|
|
|
|
|
+ 'selectDate': 'Chci datum',
|
|
|
|
|
+ 'selectField':
|
|
|
|
|
+ 'Vyberte pole kliknutím do mapy. Více polí můžete vybrat podržením klávesy SHIFT.',
|
|
|
|
|
+ 'selectMore': 'Více polí můžete vybrat podržením klávesy SHIFT',
|
|
|
|
|
+ 'selectedField': 'Vybráno pole',
|
|
|
|
|
+ 'selectedFields': 'Vybrána pole',
|
|
|
|
|
+ 'selectFieldAndIndex': 'Nejprve vyberte index a pole v mapě',
|
|
|
|
|
+ 'selectIndex': 'Vypočítat index',
|
|
|
|
|
+ 'selectIndexHint': 'Vyberte z dostupných indexů',
|
|
|
|
|
+ 'selectQuantiles': 'Počet kvantilů',
|
|
|
|
|
+ 'zoomIn': 'Pro výběr pole je potřeba mapu přiblížit.',
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ 'en': {
|
|
|
|
|
+ 'CALCULATOR': {
|
|
|
|
|
+ 'blurNone': 'none',
|
|
|
|
|
+ 'getDates': 'GET DATES',
|
|
|
|
|
+ 'getZones': 'GET ZONES',
|
|
|
|
|
+ 'errorLoading': 'Error loading data',
|
|
|
|
|
+ 'errorLoadingDates':
|
|
|
|
|
+ 'It was not possible to load available dates from the server. Please, try again later.',
|
|
|
|
|
+ 'errorLoadingZones':
|
|
|
|
|
+ 'It was not possible to load field zones from the server. This is probably due to the high cloudiness of the source image. Try another date.',
|
|
|
|
|
+ 'loading': 'Loading',
|
|
|
|
|
+ 'panelHeader': 'Field calculation',
|
|
|
|
|
+ 'selectBlur': 'Smoothing zone edges',
|
|
|
|
|
+ 'selectDate': 'I want a date',
|
|
|
|
|
+ 'selectField':
|
|
|
|
|
+ 'Select a field by clicking in the map. You can select more fields by press and holding the SHIFT key.',
|
|
|
|
|
+ 'selectMore':
|
|
|
|
|
+ 'You can select more fields by press and holding the SHIFT key',
|
|
|
|
|
+ 'selectedField': 'Selected field',
|
|
|
|
|
+ 'selectedFields': 'Selected fields',
|
|
|
|
|
+ 'selectFieldAndIndex':
|
|
|
|
|
+ 'Select an index and a field in the map to continue',
|
|
|
|
|
+ 'selectIndex': 'Calculate index',
|
|
|
|
|
+ 'selectIndexHint': 'Select one of the available indices',
|
|
|
|
|
+ 'selectQuantiles': 'Quantiles count',
|
|
|
|
|
+ 'zoomIn': 'In order to select the field, you must zoom in the map.',
|
|
|
|
|
+ },
|
|
|
|
|
+ 'PANEL_HEADER': {'CALCULATOR': 'Field calculation'},
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ };
|
|
|
this.hsConfig.update(
|
|
this.hsConfig.update(
|
|
|
{
|
|
{
|
|
|
datasources: [
|
|
datasources: [
|
|
@@ -221,11 +294,6 @@ export class AppService {
|
|
|
type: 'micka',
|
|
type: 'micka',
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
- default_view: new View({
|
|
|
|
|
- projection: this.sjtskProjection,
|
|
|
|
|
- center: transform([16.964, 49.248], 'EPSG:4326', 'EPSG:5514'),
|
|
|
|
|
- zoom: 14,
|
|
|
|
|
- }),
|
|
|
|
|
/* Use hslayers-server if you need to proxify your requests to other services. See https://www.npmjs.com/package/hslayers-server */
|
|
/* Use hslayers-server if you need to proxify your requests to other services. See https://www.npmjs.com/package/hslayers-server */
|
|
|
proxyPrefix: window.location.hostname.includes('localhost')
|
|
proxyPrefix: window.location.hostname.includes('localhost')
|
|
|
? `${window.location.protocol}//${window.location.hostname}:8085/`
|
|
? `${window.location.protocol}//${window.location.hostname}:8085/`
|
|
@@ -241,7 +309,7 @@ export class AppService {
|
|
|
componentsEnabled: {
|
|
componentsEnabled: {
|
|
|
basemapGallery: true,
|
|
basemapGallery: true,
|
|
|
},
|
|
},
|
|
|
- assetsPath: 'assets',
|
|
|
|
|
|
|
+ //assetsPath: 'assets',
|
|
|
symbolizerIcons: [
|
|
symbolizerIcons: [
|
|
|
{name: 'beach', url: '/assets/icons/beach17.svg'},
|
|
{name: 'beach', url: '/assets/icons/beach17.svg'},
|
|
|
{name: 'bicycles', url: '/assets/icons/bicycles.svg'},
|
|
{name: 'bicycles', url: '/assets/icons/bicycles.svg'},
|
|
@@ -250,83 +318,82 @@ export class AppService {
|
|
|
{name: 'warning', url: '/assets/icons/warning.svg'},
|
|
{name: 'warning', url: '/assets/icons/warning.svg'},
|
|
|
],
|
|
],
|
|
|
popUpDisplay: 'hover',
|
|
popUpDisplay: 'hover',
|
|
|
- default_layers: [
|
|
|
|
|
- /* Baselayers */
|
|
|
|
|
- new Tile({
|
|
|
|
|
- source: new OSM(),
|
|
|
|
|
- visible: true,
|
|
|
|
|
- properties: {
|
|
|
|
|
- title: 'OpenStreetMap',
|
|
|
|
|
- base: true,
|
|
|
|
|
- removable: false,
|
|
|
|
|
- },
|
|
|
|
|
- }),
|
|
|
|
|
- new Tile({
|
|
|
|
|
- properties: {
|
|
|
|
|
- title: 'Ortofoto ČÚZK',
|
|
|
|
|
- base: true,
|
|
|
|
|
- removable: false,
|
|
|
|
|
- thumbnail: 'https://www.agrihub.sk/hsl-ng/img/orto.jpg',
|
|
|
|
|
- },
|
|
|
|
|
- source: new TileWMS({
|
|
|
|
|
- url: 'https://geoportal.cuzk.cz/WMS_ORTOFOTO_PUB/WMService.aspx',
|
|
|
|
|
- params: {
|
|
|
|
|
- LAYERS: 'GR_ORTFOTORGB',
|
|
|
|
|
- },
|
|
|
|
|
- attributions: [
|
|
|
|
|
- '© <a href="geoportal.cuzk.cz" target="_blank">ČÚZK</a>',
|
|
|
|
|
- ],
|
|
|
|
|
- }),
|
|
|
|
|
- visible: false,
|
|
|
|
|
- }),
|
|
|
|
|
- /* Thematic layers */
|
|
|
|
|
- imageWmsTLayer,
|
|
|
|
|
- new VectorLayer({
|
|
|
|
|
- properties: {
|
|
|
|
|
- title: 'LPIS (WFS)',
|
|
|
|
|
- synchronize: false,
|
|
|
|
|
- cluster: false,
|
|
|
|
|
- inlineLegend: true,
|
|
|
|
|
- editor: {
|
|
|
|
|
- editable: false,
|
|
|
|
|
- },
|
|
|
|
|
- sld: fieldSld,
|
|
|
|
|
- popUp: {
|
|
|
|
|
- attributes: [
|
|
|
|
|
- 'id_dpb',
|
|
|
|
|
- 'id_uz',
|
|
|
|
|
- 'nkod_dpb',
|
|
|
|
|
- 'kultura',
|
|
|
|
|
- 'svazitost',
|
|
|
|
|
- 'vymeram',
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- //path: 'User generated',
|
|
|
|
|
- },
|
|
|
|
|
- minZoom: this.calcService.MIN_LPIS_VISIBLE_ZOOM,
|
|
|
|
|
- opacity: 0.7,
|
|
|
|
|
- source: lpisSource,
|
|
|
|
|
- }),
|
|
|
|
|
- new Tile({
|
|
|
|
|
- properties: {
|
|
|
|
|
- title: 'LPIS (WMS)',
|
|
|
|
|
- queryCapabilities: false,
|
|
|
|
|
- },
|
|
|
|
|
- maxZoom: this.calcService.MIN_LPIS_VISIBLE_ZOOM,
|
|
|
|
|
- source: new TileWMS({
|
|
|
|
|
- url: 'https://gis.lesprojekt.cz/cgi-bin/mapserv?map=/home/dima/maps/foodie/lpis.map',
|
|
|
|
|
- params: {
|
|
|
|
|
- LAYERS: 'lpis_borders', //'lpis_cultures'
|
|
|
|
|
- INFO_FORMAT: undefined,
|
|
|
|
|
- FORMAT: 'image/png; mode=8bit',
|
|
|
|
|
- },
|
|
|
|
|
- crossOrigin: 'anonymous',
|
|
|
|
|
- }),
|
|
|
|
|
- }),
|
|
|
|
|
- ],
|
|
|
|
|
- translationOverrides: i18n,
|
|
|
|
|
|
|
+ translationOverrides: mergedTranslationOverrides,
|
|
|
},
|
|
},
|
|
|
'default'
|
|
'default'
|
|
|
);
|
|
);
|
|
|
|
|
+ this.hsLanguageService.setLanguage('en');
|
|
|
|
|
+ this.hsLayoutService.setDefaultPanel('calculator');
|
|
|
|
|
+ for (const layer of [
|
|
|
|
|
+ new Tile({
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ title: 'Ortofoto ČÚZK',
|
|
|
|
|
+ base: true,
|
|
|
|
|
+ removable: false,
|
|
|
|
|
+ thumbnail: 'https://www.agrihub.sk/hsl-ng/img/orto.jpg',
|
|
|
|
|
+ },
|
|
|
|
|
+ source: new TileWMS({
|
|
|
|
|
+ url: 'https://geoportal.cuzk.cz/WMS_ORTOFOTO_PUB/WMService.aspx',
|
|
|
|
|
+ params: {
|
|
|
|
|
+ LAYERS: 'GR_ORTFOTORGB',
|
|
|
|
|
+ },
|
|
|
|
|
+ attributions: [
|
|
|
|
|
+ '© <a href="geoportal.cuzk.cz" target="_blank">ČÚZK</a>',
|
|
|
|
|
+ ],
|
|
|
|
|
+ }),
|
|
|
|
|
+ visible: false,
|
|
|
|
|
+ }),
|
|
|
|
|
+ /* Thematic layers */
|
|
|
|
|
+ imageWmsTLayer,
|
|
|
|
|
+ new VectorLayer({
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ title: 'LPIS (WFS)',
|
|
|
|
|
+ synchronize: false,
|
|
|
|
|
+ cluster: false,
|
|
|
|
|
+ queryable: true,
|
|
|
|
|
+ inlineLegend: true,
|
|
|
|
|
+ editor: {
|
|
|
|
|
+ editable: false,
|
|
|
|
|
+ },
|
|
|
|
|
+ sld: fieldSld,
|
|
|
|
|
+ popUp: {
|
|
|
|
|
+ attributes: [
|
|
|
|
|
+ 'id_dpb',
|
|
|
|
|
+ 'id_uz',
|
|
|
|
|
+ 'nkod_dpb',
|
|
|
|
|
+ 'kultura',
|
|
|
|
|
+ 'svazitost',
|
|
|
|
|
+ 'vymeram',
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ //path: 'User generated',
|
|
|
|
|
+ },
|
|
|
|
|
+ minZoom: this.calcService.MIN_LPIS_VISIBLE_ZOOM,
|
|
|
|
|
+ opacity: 0.7,
|
|
|
|
|
+ source: lpisSource,
|
|
|
|
|
+ }),
|
|
|
|
|
+ new Tile({
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ title: 'LPIS (WMS)',
|
|
|
|
|
+ queryCapabilities: false,
|
|
|
|
|
+ },
|
|
|
|
|
+ maxZoom: this.calcService.MIN_LPIS_VISIBLE_ZOOM,
|
|
|
|
|
+ source: new TileWMS({
|
|
|
|
|
+ url: 'https://gis.lesprojekt.cz/cgi-bin/mapserv?map=/home/dima/maps/foodie/lpis.map',
|
|
|
|
|
+ params: {
|
|
|
|
|
+ LAYERS: 'lpis_borders', //'lpis_cultures'
|
|
|
|
|
+ INFO_FORMAT: undefined,
|
|
|
|
|
+ FORMAT: 'image/png; mode=8bit',
|
|
|
|
|
+ },
|
|
|
|
|
+ crossOrigin: 'anonymous',
|
|
|
|
|
+ }),
|
|
|
|
|
+ }),
|
|
|
|
|
+ ]) {
|
|
|
|
|
+ this.hsMapService
|
|
|
|
|
+ .getLayersArray()
|
|
|
|
|
+ .filter((l) => getTitle(l) == getTitle(layer))
|
|
|
|
|
+ .map((l) => this.hsMapService.getMap().removeLayer(l));
|
|
|
|
|
+ this.hsMapService.addLayer(layer, 'default');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|