Sfoglia il codice sorgente

🚧 use cz geodata

jmacura 4 anni fa
parent
commit
f67714ba7b

File diff suppressed because it is too large
+ 0 - 0
src/NUTS_RG_20M_2016_3857_LEVL_2.json


File diff suppressed because it is too large
+ 0 - 0
src/NUTS_RG_20M_2016_3857_LEVL_3.json


+ 15 - 22
src/app.config.ts

@@ -1,10 +1,8 @@
-import VectorLayer from 'ol/layer/Vector';
-import View from 'ol/View';
 import {Fill, Stroke, Style} from 'ol/style';
-import {OSM} from 'ol/source';
-import {Tile} from 'ol/layer';
-
-import nuts from './nuts';
+import {GeoJSON} from 'ol/format';
+import {OSM, Vector as VectorSource} from 'ol/source';
+import {Tile, Vector as VectorLayer} from 'ol/layer';
+import {View} from 'ol';
 
 function getHostname() {
   const url = window.location.href;
@@ -30,7 +28,7 @@ function perc2color(perc) {
     g = 255;
     r = Math.round(510 - 5.1 * perc);
   }
-  // eslint-disable-next-line no-unused-vars
+  // eslint-disable-next-line @typescript-eslint/no-unused-vars
   const h = r * 0x10000 + g * 0x100 + b * 0x1;
   return `rgba(${r}, ${g}, ${b}, 0.7)`;
 }
@@ -57,20 +55,16 @@ const styles = function (feature) {
   }
 };
 
-const nuts2Layer = new VectorLayer({
-  source: nuts.nuts2Source,
-  visible: false,
-  style: styles,
-  title: 'NUTS2 regions',
-});
-
-const nuts3Layer = new VectorLayer({
-  source: nuts.nuts3Source,
+const obceLayer = new VectorLayer({
+  source: new VectorSource({
+    format: new GeoJSON(),
+    url: require('./data/obce_cr_20210310_simplified_5514.geojson').default,
+  }),
   visible: true,
   style: styles,
-  title: 'NUTS3 regions',
+  title: 'Obce ČR',
 });
-nuts3Layer.set('hoveredKeys', [
+obceLayer.set('hoveredKeys', [
   'NUTS_NAME',
   'totalForHumans',
   'Social & Human',
@@ -80,7 +74,7 @@ nuts3Layer.set('hoveredKeys', [
   'Natural',
   'Cultural',
 ]);
-nuts3Layer.set('hoveredKeysTranslations', {
+obceLayer.set('hoveredKeysTranslations', {
   NUTS_NAME: 'Name',
   totalForHumans: 'Calculated score',
 });
@@ -90,13 +84,12 @@ export const AppConfig = {
   default_layers: [
     new Tile({
       source: new OSM(),
-      title: 'Open street map',
+      title: 'OpenStreetMap',
       base: true,
       editor: {editable: false},
       removable: false,
     }),
-    nuts2Layer,
-    nuts3Layer,
+    obceLayer,
   ],
   project_name: 'erra/map',
   default_view: new View({

File diff suppressed because it is too large
+ 5 - 0
src/data/obce_cr_20210310_simplified_5514.geojson


+ 0 - 14
src/nuts.js

@@ -1,14 +0,0 @@
-import { GeoJSON } from 'ol/format';
-import { Vector as VectorSource } from 'ol/source';
-import nuts2 from './NUTS_RG_20M_2016_3857_LEVL_2.json';
-import nuts3 from './NUTS_RG_20M_2016_3857_LEVL_3.json';
-
-export default {
-  nuts2Source: new VectorSource({
-    features: (new GeoJSON()).readFeatures(nuts2)
-  }),
-
-  nuts3Source: new VectorSource({
-    features: (new GeoJSON()).readFeatures(nuts3)
-  })
-};

Some files were not shown because too many files changed in this diff