소스 검색

🚧 use cz geodata

jmacura 4 년 전
부모
커밋
f67714ba7b
5개의 변경된 파일20개의 추가작업 그리고 36개의 파일을 삭제
  1. 0 0
      src/NUTS_RG_20M_2016_3857_LEVL_2.json
  2. 0 0
      src/NUTS_RG_20M_2016_3857_LEVL_3.json
  3. 15 22
      src/app.config.ts
  4. 5 0
      src/data/obce_cr_20210310_simplified_5514.geojson
  5. 0 14
      src/nuts.js

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
src/NUTS_RG_20M_2016_3857_LEVL_2.json


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 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({

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 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)
-  })
-};

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.