@opengis/gis 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ source_path: data_bp_myo.bp
2
+ name: Будівельні паспорти Template
3
+ visible: true
4
+ style:
5
+ type: point
6
+ color: '#d970d5'
7
+ width: 2
8
+ radius: 10
9
+ border: 1
10
+ opacity: 0.4
11
+ popup:
12
+ - ua: Назва замовника
13
+ name: bp_customer_name
14
+ meta: title
15
+ - label: Реєстраційний номер БП
16
+ name: bp_code
17
+ format: badge
18
+ - label: Адреса
19
+ name: address
20
+ card:
21
+ - label: Реєстраційний номер БП
22
+ name: bp_code
23
+ - ua: Адреса
24
+ name: address
25
+ - ua: Вид будівництва
26
+ data: bp_build_type
27
+ name: bp_build_type
28
+ - ua: Назва замовника
29
+ name: bp_customer_name
30
+ - ua: Статус документа
31
+ data: doc_status
32
+ name: bp_doc_status
33
+
@@ -0,0 +1,21 @@
1
+ history: true
2
+ name: Адресний реєстр
3
+ height: calc(100vh - 65px)
4
+ center:
5
+ - 34.65450
6
+ - 48.51174
7
+ zoom: 11
8
+ layers:
9
+ - faafbea5263a
10
+ widgets:
11
+ - type: search
12
+ position: top-left
13
+ - type: info
14
+ position: top-left
15
+ config:
16
+ title: Адресний реєстр
17
+ content: "<p style='font-size: 14px; color: #34495E;'>Карта адресного реєстру відображає офіційно зареєстровані адреси на території громади або населеного пункту. До складу інформації входять дані про вулиці, будинки, типи об'єктів (житлові, комерційні, адміністративні тощо), а також структуровані компоненти адреси: назва вулиці, номер будинку, корпус, літера, тощо.</p>"
18
+ - type: layers
19
+ position: top-left
20
+ - type: basemaps
21
+ position: bottom-left
@@ -7,7 +7,11 @@
7
7
  48.51174
8
8
  ],
9
9
  "zoom": 11,
10
- "widgets":[
10
+ "layers": [
11
+ "3c95e341465d",
12
+ "dbcb186818e3"
13
+ ],
14
+ "widgets": [
11
15
  {
12
16
  "type": "search",
13
17
  "position": "top-left"
@@ -15,14 +19,18 @@
15
19
  {
16
20
  "type": "info",
17
21
  "position": "top-left",
18
- "config":{
19
- "title": "Містобудівна документація",
20
- "content": "<p style='font-size: 14px; color: #34495E;'>Затверджені текстові і графічні матеріали, якими регулюється планування, забудова та інше використання територій.</p>"
22
+ "config": {
23
+ "title": "Містобудівна документація",
24
+ "content": "<p style='font-size: 14px; color: #34495E;'>Затверджені текстові і графічні матеріали, якими регулюється планування, забудова та інше використання територій.</p>"
21
25
  }
22
26
  },
23
- {
27
+ {
24
28
  "type": "layers",
25
- "position": "top-left"
29
+ "position": "top-left",
30
+ "config": {
31
+ "title": "Шари мапи",
32
+ "description": "Доступні шари мапи містобудівна документація"
33
+ }
26
34
  },
27
35
  {
28
36
  "type": "basemaps",
@@ -32,10 +40,5 @@
32
40
  "type": "legend",
33
41
  "position": "bottom-right"
34
42
  }
35
- ],
36
- "old":["bp","3c95e341465d"],
37
- "layers": [
38
- "3c95e341465d",
39
- "dbcb186818e3"
40
43
  ]
41
- }
44
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "history": true,
3
+ "height": "calc(100vh - 65px)",
4
+ "center": [
5
+ 34.65450,
6
+ 48.51174
7
+ ],
8
+ "layers":["bp1"],
9
+ "widgets": [
10
+ {
11
+ "type": "info",
12
+ "position": "top-left",
13
+ "config": {
14
+ "title": "Будівельні паспорти",
15
+ "content": "<p style='font-size: 14px; color: #34495E;'>Затверджені текстові і графічні матеріали, якими регулюється планування, забудова та інше використання територій.</p>"
16
+ }
17
+ },
18
+ {
19
+ "type": "layers",
20
+ "position": "top-left",
21
+ "visible": true
22
+ },
23
+ {
24
+ "type": "dataset",
25
+ "position": "top-right",
26
+ "title": "Густота населення",
27
+ "config": {
28
+ "layer": "bp",
29
+ "attribute": "status"
30
+ },
31
+ "visible": true
32
+ },
33
+
34
+
35
+ {
36
+ "type": "basemaps",
37
+ "position": "bottom-left",
38
+ "title": "Базові карти",
39
+ "visible": true
40
+ }
41
+
42
+ ]
43
+
44
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "history": true,
3
- "height": "calc(100vh - 65px)",
4
- "center": [
3
+ "height": "calc(100vh - 65px)",
4
+ "center": [
5
5
  34.65450,
6
- 48.51174
6
+ 48.51174
7
7
  ],
8
8
  "layers":["9587e69d35fd"],
9
9
  "widgets": [
@@ -13,7 +13,7 @@
13
13
  "config": {
14
14
  "title": "Містобудівна документація",
15
15
  "content": "<p style='font-size: 14px; color: #34495E;'>Затверджені текстові і графічні матеріали, якими регулюється планування, забудова та інше використання територій.</p>"
16
- }
16
+ }
17
17
  },
18
18
  {
19
19
  "type": "layers",
@@ -22,16 +22,16 @@
22
22
  },
23
23
  {
24
24
  "type": "dataset",
25
- "position": "top-right",
25
+ "position": "top-left",
26
26
  "title": "Густота населення",
27
27
  "config": {
28
- "layer_id": "municipalities",
29
- "attribute": "status"
28
+ "layer": "9587e69d35fd",
29
+ "list":[{"id":"status","text":"Статус" },{"id":"type_work_id","text":"Тип робіт"}]
30
30
  },
31
31
  "visible": true
32
32
  },
33
-
34
-
33
+
34
+
35
35
  {
36
36
  "type": "legend",
37
37
  "position": "bottom-right",
@@ -75,12 +75,12 @@
75
75
  {
76
76
  "type": "basemaps",
77
77
  "position": "bottom-left",
78
- "title": "Базові карти",
78
+ "title": "Базові карти",
79
79
  "visible": true
80
80
  }
81
-
81
+
82
82
  ],
83
-
83
+
84
84
  "tools": [
85
85
  "home",
86
86
  "geolocation",
@@ -88,4 +88,4 @@
88
88
  "area",
89
89
  "print"
90
90
  ]
91
- }
91
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "history": true,
3
- "height": "calc(100vh - 65px)",
4
- "center": [
3
+ "height": "calc(100vh - 65px)",
4
+ "center": [
5
5
  34.65450,
6
- 48.51174
6
+ 48.51174
7
7
  ],
8
8
  "zoom": 11,
9
9
  "layers": ["ed67980cd690"],
@@ -13,31 +13,35 @@
13
13
  "position": "top-left",
14
14
  "config": {
15
15
  "title": "Тимчасові споруди",
16
- "content": "<p style='font-size: 14px; color: #34495E;'>Інформація про тимчасові споруди встановлені на території м. Кам'янське</p>"
16
+ "content": "<p style='font-size: 14px; color: #34495E;'>Інформація про тимчасові споруди встановлені на території м. Кам'янське</p>"
17
17
  }
18
18
  },
19
19
  {
20
20
  "type": "dataset",
21
21
  "position": "top-left",
22
22
  "config": {
23
- "layer":"ed67980cd690",
24
- "attribute":"status"
23
+ "layer":"ed67980cd690",
24
+ "attribute":"temp_structure_type",
25
+ "colors":{
26
+ "1":"#3a7a57",
27
+ "2":"#8e4484"
28
+ }
25
29
  }
26
30
  },
27
31
  {
28
32
  "type": "layers",
29
- "visible":false
33
+ "visible":false
30
34
  },
31
35
  {
32
36
  "type": "legend",
33
- "position":"bottom-right"
37
+ "position":"bottom-right"
34
38
  },
35
39
  {
36
40
  "type": "basemaps",
37
41
  "position": "bottom-left",
38
- "title": "Базові карти"
42
+ "title": "Базові карти"
39
43
  }
40
- ],
44
+ ],
41
45
  "tools": [
42
46
  "home",
43
47
  "geolocation",
@@ -45,4 +49,4 @@
45
49
  "area",
46
50
  "print"
47
51
  ]
48
- }
52
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/gis",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "author": "Softpro",
6
6
  "main": "./dist/index.js",
@@ -16,6 +16,8 @@
16
16
  ],
17
17
  "scripts": {
18
18
  "start1": "bun server",
19
+ "lint": "eslint src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts",
20
+ "fix": "eslint src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",
19
21
  "patch": "npm version patch && git push && npm publish",
20
22
  "dev": "bun --hot server",
21
23
  "front": "vite dev",
@@ -35,21 +37,25 @@
35
37
  "carto": "0.16.3"
36
38
  },
37
39
  "peerDependencies": {
38
- "@opengis/fastify-table": "^2.0.23"
40
+ "@opengis/fastify-table": "^2.0.32"
39
41
  },
40
42
  "resolutions": {
41
43
  "rollup": "4.30.0"
42
44
  },
43
45
  "devDependencies": {
44
46
  "@opengis/core": "^0.0.23",
45
- "@opengis/fastify-table": "^2.0.23",
47
+ "@opengis/fastify-table": "^2.0.32",
46
48
  "@opengis/filter": "^0.1.7",
47
- "@opengis/form": "^0.0.42",
49
+ "@opengis/form": "^0.0.48",
48
50
  "@opengis/table": "^0.0.27",
49
51
  "@vitejs/plugin-vue": "^5.2.3",
50
52
  "axios": "^1.11.0",
51
53
  "eslint": "8.49.0",
52
54
  "eslint-config-airbnb": "19.0.4",
55
+ "eslint-plugin-import": "^2.25.3",
56
+ "eslint-plugin-vue": "^9.17.0",
57
+ "@vue/eslint-config-typescript": "^12.0.0",
58
+ "vue-eslint-parser": "^10.2.0",
53
59
  "lucide-vue-next": "^0.514.0",
54
60
  "sass-embedded": "1.86.3",
55
61
  "typescript": "^5.9.2",
@@ -58,4 +64,4 @@
58
64
  "vue-router": "4.5.1",
59
65
  "vuedraggable": "^4.1.0"
60
66
  }
61
- }
67
+ }
@@ -9,9 +9,8 @@ const isProduction = process.env.NODE_ENV === 'production' || config.production;
9
9
  console.log({ isProduction });
10
10
 
11
11
  async function plugin(fastify, opts) {
12
-
13
12
  const viteServer = !isProduction ? await createServer({
14
- root: `admin`,
13
+ root: 'admin',
15
14
  server: {
16
15
  middlewareMode: true,
17
16
  },
@@ -21,7 +20,6 @@ async function plugin(fastify, opts) {
21
20
  const dir1 = process.cwd();
22
21
  viteServer.watcher.add(dir1);
23
22
  viteServer.watcher.on('all', (d, t) => {
24
-
25
23
  if (!t.includes('module')) return;
26
24
  console.log(d, t);
27
25
  viteServer.ws.send({ type: 'full-reload' });
@@ -49,7 +47,7 @@ async function plugin(fastify, opts) {
49
47
  const filePath = fs.existsSync(filePathDist) ? filePathDist : filePathAssets; // check dist or assets
50
48
  const ext = path.extname(filePath);
51
49
 
52
- if (!fs.existsSync(filePath)) return { status: 404, message: 'not found' }
50
+ if (!fs.existsSync(filePath)) return { status: 404, message: 'not found' };
53
51
  const mime = {
54
52
  '.js': 'text/javascript', '.css': 'text/css', '.woff2': 'application/font-woff', '.png': 'image/png', '.svg': 'image/svg+xml', '.jpg': 'image/jpg',
55
53
  }[ext];
@@ -69,9 +67,7 @@ async function plugin(fastify, opts) {
69
67
  if (!isProduction) return null; // admin vite
70
68
  const stream = fs.createReadStream('admin/dist/index.html');
71
69
  return reply.type('text/html').send(stream);
72
-
73
- })
70
+ });
74
71
  }
75
72
 
76
73
  export default plugin;
77
-
@@ -31,7 +31,10 @@ export default async function getMap({ params = {}, pg = pgClients.client }, rep
31
31
 
32
32
  const totals = pg.queryCache ? await pg.queryCache(`select json_object_agg(oid::regclass, reltuples) from pg_class`)
33
33
  .then(el => el.rows?.[0]?.json_object_agg || {}) : {};
34
-
34
+ const maps = pg.pk?.['gis.maps'] ? await pg.query(
35
+ `SELECT map_id as slug, name FROM gis.maps`).then(el => el.rows || []) : [];
36
+
37
+
35
38
  if (params.id) {
36
39
  const map = rows[0] || {};
37
40
  const loadTemplate = await getTemplate('map', params.id) || await getTemplate('map', map.map_key);
@@ -43,13 +46,13 @@ export default async function getMap({ params = {}, pg = pgClients.client }, rep
43
46
  const layerData = await getTemplate('layer', layer);
44
47
  const serviceData = layerData || await pg.query('select service_id as id, *, st_asgeojson(bbox)::json as bbox, st_asgeojson(center)::json as center from gis.services where service_id=$1', [layer]).then(el => el.rows?.[0]);
45
48
  Object.assign(serviceData, { count: totals[serviceData.source_path || ''] || 0 });
46
- serviceData.style = yaml.load(serviceData.style);
49
+ serviceData.style = typeof serviceData.style ==='object'?serviceData.style: yaml.load(serviceData.style);
47
50
  return { ...serviceData, id: layer, visible: true };
48
51
  }));
49
- return { ...rows[0], ...obj, layers };
52
+ return { maps,...rows[0], ...obj, layers };
50
53
  }
51
54
 
52
- return reply.status(200).send({ ...rows[0], ...loadTemplate });
55
+ return reply.status(200).send({ maps, ...rows[0], ...loadTemplate });
53
56
  }
54
57
 
55
58
  if (params.id && !rows.length) {
@@ -15,28 +15,15 @@ export default async function vtile({ params = {}, query, pg, user }, reply) {
15
15
 
16
16
  // layer
17
17
  const [map, layer] = params.layer.includes(':') ? params.layer.split(':') : [null, params.layer];
18
- const data = await getTemplate('layer', layer);
18
+
19
19
  // service
20
- const data1 = await pg.query(`select * from gis.services where is_active and ${!user?.uid ? 'is_public' : '1=1'} and service_id=$1`, [layer]).then(el => el.rows?.[0]);
21
- if (!data && !data1) return { status: 404, message: 'not found' }
22
-
23
- // style
24
- const mapData = map ? await getTemplate('map', map) : {};
25
- const mapStyle = mapData?.widgets?.find?.(el => el.type === 'attribute')?.config?.layer?.style;
26
-
27
- const geom = data?.geometry_column
28
- || data1?.geometry_column
29
- || 'geom';
30
- const table = data?.source_path
31
- || data?.table_name
32
- || data1?.source_path;
33
- const style = mapStyle
34
- || data?.style
35
- || (data1?.style ? yaml.load(data1?.style) : null);
36
- const filterList = data?.filters
37
- || data?.filter_list
38
- || data1?.filters;
39
- const layerQuery = data?.query || data1?.query;
20
+ const data = await getTemplate('layer', layer) || await pg.query(`select * from gis.services where is_active and ${!user?.uid ? 'is_public' : '1=1'} and service_id=$1`, [layer]).then(el => el.rows?.[0]);
21
+
22
+ const geom = data?.geometry_column || 'geom';
23
+ const table = data?.source_path;
24
+ const style = typeof data?.style ==='object'?data?.style: yaml.load(data?.style) ;
25
+ const filterList = data?.filters;
26
+ const layerQuery = data?.query;
40
27
 
41
28
  // bbox
42
29
  const bbox = mercator.bbox(+y, +x, +z, false/* , '900913' */);
@@ -57,7 +44,7 @@ export default async function vtile({ params = {}, query, pg, user }, reply) {
57
44
  return el.type?.[0] === '_' ? `${el.name}[1] as ${el.name}` : `${el.name}${['int4'].includes(el.type) ? '::text' : ''}`;
58
45
  });
59
46
 
60
- const obj = (data1.attributes || []).concat(data1.card || []).concat(data1.popup || []).filter(el => el.data).reduce((acc, curr) => ({ ...acc, [curr.name]: curr.data }), {});
47
+ const obj = (data.card || []).concat(data.popup || []).filter(el => el.data).reduce((acc, curr) => ({ ...acc, [curr.name]: curr.data }), {});
61
48
 
62
49
  const propsWithCls = propsCache[layer] ?? await Promise.all(props.map(async (key, idx) => {
63
50
  const { name, type, sql } = getColumnCLS(table, key) || {};
@@ -1,6 +0,0 @@
1
- label: Адреси
2
- source_path: data_address.address
3
- style:
4
- color: "#555"
5
- weight: 1.5
6
- visible: false
@@ -1,22 +0,0 @@
1
- ---
2
- id: address
3
- name: address
4
- title: Адресний реєстр
5
- description: Адресний реєстр
6
- center:
7
- - 30.5234
8
- - 50.4501
9
- zoom: 12
10
- basemap: osm
11
- sources: []
12
- widgets:
13
- - type: legend
14
- position: bottom-right
15
- config:
16
- items:
17
- - label: Житлова зона
18
- color: "#4caf50"
19
- - label: Комерційна зона
20
- color: "#2196f3"
21
- - label: Промислова зона
22
- color: "#f44336"
@@ -1,16 +0,0 @@
1
- label: Вулиці
2
- source_path: data_address.street.table
3
- style:
4
- attribute: type
5
- colors:
6
- "1": "#4caf50"
7
- "2": "#2196f3"
8
- "3": "#f44336"
9
- "4": "#4caf50"
10
- "5": "#2196f3"
11
- "6": "#f44336"
12
- "8": "#4caf50"
13
- "9": "#2196f3"
14
- "11": "#f44336"
15
- "16": "#4caf50"
16
- visible: true
@@ -1,9 +0,0 @@
1
- {
2
- "label": "Адреси",
3
- "source_path": "data_address.address",
4
- "style": {
5
- "color": "#555",
6
- "weight": 1.5
7
- },
8
- "visible": false
9
- }
@@ -1,35 +0,0 @@
1
- {
2
- "id": "address3",
3
- "name": "address",
4
- "title": "Адресний реєстр",
5
- "description": "Адресний реєстр",
6
- "center": [
7
- 30.5234,
8
- 50.4501
9
- ],
10
- "zoom": 12,
11
- "basemap": "osm",
12
- "sources": [],
13
- "widgets": [
14
- {
15
- "type": "legend",
16
- "position": "bottom-right",
17
- "config": {
18
- "items": [
19
- {
20
- "label": "Житлова зона",
21
- "color": "#4caf50"
22
- },
23
- {
24
- "label": "Комерційна зона",
25
- "color": "#2196f3"
26
- },
27
- {
28
- "label": "Промислова зона",
29
- "color": "#f44336"
30
- }
31
- ]
32
- }
33
- }
34
- ]
35
- }
@@ -1,19 +0,0 @@
1
- {
2
- "label": "Вулиці",
3
- "source_path": "data_address.street.table",
4
- "style": {
5
- "attribute": "type",
6
- "colors": {
7
- "1": "#4caf50",
8
- "2": "#2196f3",
9
- "3": "#f44336",
10
- "4": "#4caf50",
11
- "5": "#2196f3",
12
- "6": "#f44336",
13
- "8": "#4caf50",
14
- "9": "#2196f3",
15
- "11": "#f44336",
16
- "16": "#4caf50"
17
- }
18
- }
19
- }
@@ -1,52 +0,0 @@
1
- ---
2
- id: address1
3
- name: address1
4
- title: Адресний реєстр
5
- description: Адресний реєстр.
6
- center:
7
- - 30.5234
8
- - 50.4501
9
- zoom: 12
10
- basemap: osm
11
- sources: []
12
- layers:
13
- - id: address3
14
- label: Адреси
15
- source_path: data_address.address
16
- style:
17
- attribute: type
18
- colors:
19
- build: "Будівля / Споруда"
20
- countrySeat: "Садибний / Садовий / Дачний будинок"
21
- landPlot: "Земельна ділянка"
22
- complex: "Комплекс будівель і споруд"
23
- undergroundObject: "Підземний об’єкт"
24
- visible: true
25
- - id: street3
26
- label: Вулиці
27
- source_path: data_address.street.table
28
- style:
29
- attribute: type
30
- colors:
31
- "1": "#4caf50"
32
- "2": "#2196f3"
33
- "3": "#f44336"
34
- "4": "#4caf50"
35
- "5": "#2196f3"
36
- "6": "#f44336"
37
- "8": "#4caf50"
38
- "9": "#2196f3"
39
- "11": "#f44336"
40
- "16": "#4caf50"
41
- visible: true
42
- widgets:
43
- - type: legend
44
- position: bottom-right
45
- config:
46
- items:
47
- - label: Житлова зона
48
- color: "#4caf50"
49
- - label: Комерційна зона
50
- color: "#2196f3"
51
- - label: Промислова зона
52
- color: "#f44336"
@@ -1,34 +0,0 @@
1
- {
2
- "id": "address2",
3
- "name": "address",
4
- "title": "Адресний реєстр",
5
- "description": "Адресний реєстр.",
6
- "center": [
7
- 30.5234,
8
- 50.4501
9
- ],
10
- "zoom": 12,
11
- "layers": [],
12
- "widgets": [
13
- {
14
- "type": "legend",
15
- "position": "bottom-right",
16
- "config": {
17
- "items": [
18
- {
19
- "label": "Житлова зона",
20
- "color": "#4caf50"
21
- },
22
- {
23
- "label": "Комерційна зона",
24
- "color": "#2196f3"
25
- },
26
- {
27
- "label": "Промислова зона",
28
- "color": "#f44336"
29
- }
30
- ]
31
- }
32
- }
33
- ]
34
- }