@opengis/gis 0.2.0 → 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.
- package/dist/index.css +1 -1
- package/dist/index.js +5317 -3461
- package/dist/index.umd.cjs +53 -38
- package/module/cls.json +2 -1
- package/module/gis/form/gis.maps.form.json +2 -2
- package/module/gis/form/gis.registers.form.json +8 -199
- package/module/gis/form/gis.services.form.json +11 -200
- package/module/gis/table/gis.maps.table.json +5 -7
- package/module/gis/table/gis.ogc_service.table.json +14 -3
- package/module/gis/table/gis.registers.table.json +2 -3
- package/module/gis/table/gis.services.table.json +19 -6
- package/module/test/cls/ts.temp_status.json +18 -0
- package/module/test/cls/ts.temp_type.json +10 -0
- package/module/test/layer/bp1.yml +33 -0
- package/module/test/map/addr.yml +21 -0
- package/module/test/map/bp_myo.json +22 -15
- package/module/test/map/bpf.json +44 -0
- package/module/test/map/mbd.json +13 -13
- package/module/test/map/ts.json +15 -11
- package/module/test/select/address_id.json +3 -0
- package/module/test/select/address_id.sql +8 -0
- package/module/test/table/data_bp_myo.bp.table.json +123 -0
- package/package.json +11 -5
- package/server/migrations/ogc.sql +107 -0
- package/server/plugins/vite.js +3 -7
- package/server/routes/gis/index.mjs +16 -2
- package/server/routes/gis/ogc/map.info.point.js +120 -0
- package/server/routes/gis/registers/funcs/classifiers.js +6 -3
- package/server/routes/gis/registers/funcs/handleRegistryRequest.js +15 -22
- package/server/routes/gis/registers/gis.registry.js +3 -2
- package/server/routes/gis/services/add.service.js +5 -5
- package/server/routes/gis/services/get.services.col.js +19 -11
- package/server/routes/gis/services/get.services.js +25 -12
- package/server/routes/map/controllers/layerList.js +14 -2
- package/server/routes/map/controllers/mapFeatures.js +11 -2
- package/server/routes/map/controllers/mapFormat.js +13 -16
- package/server/routes/map/controllers/vtile.js +1 -1
- package/server/routes/map/maps/get.map.js +17 -12
- package/server/routes/map/vtile1.js +38 -23
- package/module/test/map/address/addr.yml +0 -6
- package/module/test/map/address/index.yml +0 -22
- package/module/test/map/address/street.yml +0 -16
- package/module/test/map/address2/addr.json +0 -9
- package/module/test/map/address2/index.json +0 -35
- package/module/test/map/address2/street.json +0 -19
- package/module/test/map/address3.yml +0 -52
- package/module/test/map/address4.json +0 -34
|
@@ -4,37 +4,26 @@ const headers = {
|
|
|
4
4
|
};
|
|
5
5
|
import Sphericalmercator from '@mapbox/sphericalmercator';
|
|
6
6
|
const mercator = new Sphericalmercator({ size: 256 });
|
|
7
|
-
import { getTemplate, getMeta, getFilterSQL } from '@opengis/fastify-table/utils.js';
|
|
7
|
+
import { getColumnCLS, getTemplate, getMeta, getFilterSQL } from '@opengis/fastify-table/utils.js';
|
|
8
8
|
import yaml from 'js-yaml';
|
|
9
9
|
|
|
10
|
+
const propsCache = {};
|
|
11
|
+
|
|
10
12
|
export default async function vtile({ params = {}, query, pg, user }, reply) {
|
|
11
13
|
const { y, z } = params;
|
|
12
14
|
const x = params.x.split('.')[0] - 0;
|
|
13
15
|
|
|
14
16
|
// layer
|
|
15
17
|
const [map, layer] = params.layer.includes(':') ? params.layer.split(':') : [null, params.layer];
|
|
16
|
-
|
|
18
|
+
|
|
17
19
|
// service
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const geom = data?.geometry_column
|
|
26
|
-
|| data1?.geometry_column
|
|
27
|
-
|| 'geom';
|
|
28
|
-
const table = data?.source_path
|
|
29
|
-
|| data?.table_name
|
|
30
|
-
|| data1?.source_path;
|
|
31
|
-
const style = mapStyle
|
|
32
|
-
|| data?.style
|
|
33
|
-
|| (data1?.style ? yaml.load(data1?.style) : null);
|
|
34
|
-
const filterList = data?.filters
|
|
35
|
-
|| data?.filter_list
|
|
36
|
-
|| data1?.filters;
|
|
37
|
-
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;
|
|
38
27
|
|
|
39
28
|
// bbox
|
|
40
29
|
const bbox = mercator.bbox(+y, +x, +z, false/* , '900913' */);
|
|
@@ -55,6 +44,32 @@ export default async function vtile({ params = {}, query, pg, user }, reply) {
|
|
|
55
44
|
return el.type?.[0] === '_' ? `${el.name}[1] as ${el.name}` : `${el.name}${['int4'].includes(el.type) ? '::text' : ''}`;
|
|
56
45
|
});
|
|
57
46
|
|
|
47
|
+
const obj = (data.card || []).concat(data.popup || []).filter(el => el.data).reduce((acc, curr) => ({ ...acc, [curr.name]: curr.data }), {});
|
|
48
|
+
|
|
49
|
+
const propsWithCls = propsCache[layer] ?? await Promise.all(props.map(async (key, idx) => {
|
|
50
|
+
const { name, type, sql } = getColumnCLS(table, key) || {};
|
|
51
|
+
if (name && type === 'cls') {
|
|
52
|
+
return `(select name from admin.cls where parent='${name}' and code::text="${key}"::text limit 1) as "${key}_text","${key}"::text`;
|
|
53
|
+
}
|
|
54
|
+
if (type === 'select' && sql) {
|
|
55
|
+
const { fields = [] } = await pg.query(sql + ' limit 0');
|
|
56
|
+
return `(select "${fields[1].name}" from (${sql})s${idx} where "${fields[0].name}"="${key}" limit 1) as "${key}_text","${key}"::text`
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (obj[key]) {
|
|
60
|
+
const clsdata = await pg.query('select name, type, data as sql from admin.cls where name=$1', [obj[key]]).then(el => el.rows?.[0] || {});
|
|
61
|
+
if (clsdata.name && clsdata.type === 'json') {
|
|
62
|
+
return `(select name from admin.cls where parent='${clsdata.name}' and code::text="${key}"::text limit 1) as "${key}_text","${key}"::text`;
|
|
63
|
+
}
|
|
64
|
+
if (clsdata.type === 'sql' && clsdata.sql) {
|
|
65
|
+
const { fields = [] } = await pg.query(clsdata.sql + ' limit 0');
|
|
66
|
+
return `(select "${fields[1].name}" from (${clsdata.sql})s${idx} where "${fields[0].name}"="${key}" limit 1) as "${key}_text","${key}"::text`
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return `"${key}"::text`;
|
|
70
|
+
}));
|
|
71
|
+
if (!propsCache[layer]) { propsCache[layer] = propsWithCls; }
|
|
72
|
+
|
|
58
73
|
const geomCol = (style?.type === 'point' ? `ST_Centroid(${geom})` : null)
|
|
59
74
|
|| (parseInt(z, 10) < parseInt(query.pointZoom || style?.pointZoom || style?.iconZoom || '0', 10) ? `ST_Centroid(${geom})` : geom);
|
|
60
75
|
|
|
@@ -90,7 +105,7 @@ export default async function vtile({ params = {}, query, pg, user }, reply) {
|
|
|
90
105
|
|
|
91
106
|
floor(random() * 100000 + 1)::int + row_number() over() as row,
|
|
92
107
|
|
|
93
|
-
${props?.length ? `${
|
|
108
|
+
${props?.length ? `${propsWithCls.join(',')},` : ''}
|
|
94
109
|
|
|
95
110
|
${pkey} as id,
|
|
96
111
|
ST_AsMVTGeom(st_transform(${geomCol},3857),ST_TileEnvelope(${z},${y},${x})::box2d,4096,256,false) geom
|
|
@@ -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,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
|
-
}
|