@opengis/gis 0.2.128 → 0.2.130
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/{CardIcon-DgpYeKbG.js → CardIcon-BeZkp0PF.js} +1 -1
- package/dist/{EntityTablePage-DNdVavT4.js → EntityTablePage-A1oEJgB4.js} +1 -1
- package/dist/{ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-DQnIBCpE.js → ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-Wr8oJ-ni.js} +24 -22
- package/dist/{HeaderActions.vue_vue_type_script_setup_true_lang-Cg2y4sIa.js → HeaderActions.vue_vue_type_script_setup_true_lang-6BnXldBs.js} +345 -321
- package/dist/{MapSettings-CHF3VpUu.js → MapSettings-EmXkXJ90.js} +12 -12
- package/dist/{RastersTablePage-Ci3P3r4c.js → RastersTablePage-Cgecxbky.js} +1 -1
- package/dist/cartocss-C29B9mz3.js +1024 -0
- package/dist/{import-utils-ElncWVJV.js → import-utils-CFjQD50e.js} +1 -1
- package/dist/{index-UGx54M0Q.js → index-1vaLWtnh.js} +377 -386
- package/dist/index.css +1 -1
- package/dist/index.js +4 -4
- package/dist/index.umd.cjs +41 -41
- package/dist/raster-DFuH49fc.js +792 -0
- package/dist/{register-BfNUPbey.js → register-COO0Y_MS.js} +3 -3
- package/dist/{service-DsykdHry.js → service-DagZaIev.js} +911 -879
- package/dist/{vs-datatable-D6g7tjZo.js → vs-datatable-BaMRTZVi.js} +1 -1
- package/package.json +2 -2
- package/server/routes/gis/cartocss/get.cartocss.js +11 -2
- package/server/routes/gis/registers/add.registry.js +3 -4
- package/server/routes/gis/registers/funcs/columns.js +2 -4
- package/server/routes/mapnik/controllers/pretile.js +6 -7
- package/server/routes/mapnik/controllers/rasterInfo.js +5 -1
- package/server/routes/mapnik/functions/cartoBounds.js +6 -2
- package/dist/cartocss-BsaIlSRb.js +0 -894
- package/dist/raster-BDWEafwx.js +0 -663
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as F, mergeModels as O, defineAsyncComponent as I, useModel as R, ref as y, watch as K, openBlock as o, createElementBlock as s, createElementVNode as e, createVNode as $, unref as x, withCtx as S, createStaticVNode as V, useSlots as P, computed as H, Fragment as b, createTextVNode as U, createCommentVNode as N, renderList as A, normalizeStyle as Q, toDisplayString as M, normalizeClass as z, withModifiers as X, createBlock as Y, resolveDynamicComponent as ee, withDirectives as te, renderSlot as ne } from "vue";
|
|
2
2
|
import { notify as E } from "@opengis/core";
|
|
3
3
|
import { Edit as le, Trash as oe } from "lucide-vue-next";
|
|
4
|
-
import { _ as u } from "./index-
|
|
4
|
+
import { _ as u } from "./index-1vaLWtnh.js";
|
|
5
5
|
const se = { class: "flex items-center justify-center col-span-3 gap-2" }, re = { class: "flex justify-end p-[20px] gap-[10px] border-t w-full" }, ie = /* @__PURE__ */ F({
|
|
6
6
|
__name: "vs-datatable-controls",
|
|
7
7
|
props: /* @__PURE__ */ O({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengis/gis",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.130",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Softpro",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@opengis/core": "^0.0.23",
|
|
56
|
-
"@opengis/fastify-table": "^2.
|
|
56
|
+
"@opengis/fastify-table": "^2.1.1",
|
|
57
57
|
"@opengis/filter": "0.1.33",
|
|
58
58
|
"@opengis/form": "^0.0.133",
|
|
59
59
|
"@opengis/table": "^0.0.27",
|
|
@@ -10,13 +10,15 @@ const { prefix = '/api' } = config;
|
|
|
10
10
|
const exclude = ['created_at', 'updated_at', 'created_by', 'updated_by'];
|
|
11
11
|
|
|
12
12
|
export default async function checkCarto({
|
|
13
|
-
pg = pgClients.client, params,
|
|
13
|
+
pg = pgClients.client, params, query, user,
|
|
14
14
|
}, reply) {
|
|
15
15
|
const time = Date.now();
|
|
16
16
|
if (!config.mapnik?.server) {
|
|
17
17
|
return reply.status(400).send({ error: 'mapnik server address needed', code: 400 });
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
const { sql } = query || {};
|
|
21
|
+
|
|
20
22
|
// extract all columns, migrations-agnostic
|
|
21
23
|
const cartocss = await pg.query('select *, ARRAY[ST_XMin(geom), ST_YMin(geom), ST_XMax(geom), ST_YMax(geom)] as bounds, st_asgeojson(geom)::json as geom, source_path from gis.cartocss where cartocss_id=$1', [params.id]).then(el => el.rows?.[0]);
|
|
22
24
|
|
|
@@ -36,7 +38,13 @@ export default async function checkCarto({
|
|
|
36
38
|
}).catch(err => ({ err: err.toString() }));
|
|
37
39
|
|
|
38
40
|
// skip empty bounds[null,null,null,null]
|
|
39
|
-
const bounds = cartocss.bounds && cartocss.geom ? cartocss.bounds : await cartoBounds({
|
|
41
|
+
const bounds = cartocss.bounds && cartocss.geom ? cartocss.bounds : await cartoBounds({
|
|
42
|
+
id: params.id, dataset: cartocss.config, table: cartocss.card_table, sql,
|
|
43
|
+
}, pg).catch(err => ({ err: err.toString() }));
|
|
44
|
+
|
|
45
|
+
if (!(cartocss.bounds && cartocss.geom) && sql && user?.user_type?.includes?.('admin')) {
|
|
46
|
+
return bounds;
|
|
47
|
+
}
|
|
40
48
|
|
|
41
49
|
return {
|
|
42
50
|
time: Date.now() - time,
|
|
@@ -46,5 +54,6 @@ export default async function checkCarto({
|
|
|
46
54
|
bounds,
|
|
47
55
|
render: !!rtile.base64,
|
|
48
56
|
renderError: rtile.err && config.local ? rtile.err : !!rtile.err,
|
|
57
|
+
boundsError: bounds?.err && config.local ? bounds.err : !!bounds.err,
|
|
49
58
|
};
|
|
50
59
|
}
|
|
@@ -4,18 +4,17 @@ export default async function addGisRegistry({
|
|
|
4
4
|
method, params = {}, body, pg = pgClients.client, user = {},
|
|
5
5
|
}, reply) {
|
|
6
6
|
if (method === 'POST') {
|
|
7
|
-
|
|
8
7
|
if (!body?.register_key) {
|
|
9
8
|
return reply.status(400).send('not enough body params: register_key');
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
const
|
|
11
|
+
const res = await dataInsert({
|
|
13
12
|
pg,
|
|
14
13
|
table: 'gis.registers',
|
|
15
14
|
data: body,
|
|
16
15
|
uid: user?.uid,
|
|
17
16
|
});
|
|
18
|
-
return reply.status(200).send(
|
|
17
|
+
return reply.status(200).send(res.data);
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
if (!params.slug) {
|
|
@@ -33,4 +32,4 @@ export default async function addGisRegistry({
|
|
|
33
32
|
});
|
|
34
33
|
|
|
35
34
|
return reply.status(200).send(row);
|
|
36
|
-
}
|
|
35
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
export function extractVisibleColumns(columns, mode = "table") {
|
|
2
|
-
return columns.filter((col) =>
|
|
3
|
-
|
|
4
|
-
);
|
|
5
|
-
}
|
|
2
|
+
return (columns || []).filter((col) => (mode === "card" ? col.hidden_card !== true : col.hidden_register !== true));
|
|
3
|
+
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import convertBoundToTile from '../functions/convertBoundToTile.js';
|
|
8
8
|
import mapnik from '../../../plugins/mapnik/funcs/mapnik.js';
|
|
9
9
|
import cartoBounds from '../functions/cartoBounds.js';
|
|
10
|
+
import rasterInfo from './rasterInfo.js';
|
|
10
11
|
|
|
11
12
|
const { RenderTile } = mapnik();
|
|
12
13
|
|
|
@@ -53,6 +54,10 @@ export default async function pretile({
|
|
|
53
54
|
return reply.status(404).send({ error: 'not found', code: 404 });
|
|
54
55
|
}
|
|
55
56
|
|
|
57
|
+
if (!data.bounds || data.bounds === 'BOX(-180 -85.05112877980659,180 85.05112877980659)') {
|
|
58
|
+
return reply.status(400).send({ error: 'geom is not set', code: 400 });
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
const send = eventStream(reply);
|
|
57
62
|
|
|
58
63
|
try {
|
|
@@ -60,16 +65,10 @@ export default async function pretile({
|
|
|
60
65
|
const name = data.source_type === 'css' ? ['vector', config.mapnik?.folder || '', data.source_path || params.id].filter(Boolean).join('/') : null;
|
|
61
66
|
|
|
62
67
|
// refresh extent
|
|
63
|
-
const bounds = data.
|
|
64
|
-
? await cartoBounds({ id: data.cartocss_id, dataset: data.config/* , table: data.card_table */ }, pg)
|
|
65
|
-
: data.bounds?.replace?.(')', '').substr(4).split(/[, ]/g).map((el) => el - 0);
|
|
68
|
+
const bounds = data.bounds.replace(')', '').substr(4).split(/[, ]/g).map((el) => el - 0);
|
|
66
69
|
|
|
67
70
|
send(`start: ${data.name} ${params.id} ${bounds} ${data.srid} ${data.proj4}`);
|
|
68
71
|
|
|
69
|
-
if (!bounds) {
|
|
70
|
-
return send('geom is not set');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
72
|
bounds[0] = Math.max(bounds[0], maxBounds[0]);
|
|
74
73
|
bounds[1] = Math.max(bounds[1], maxBounds[1]);
|
|
75
74
|
|
|
@@ -16,7 +16,7 @@ export default async function rasterInfo({
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const raster = pg.pk?.['gis.rasters']
|
|
19
|
-
? await pg.query('select raster_id, source_path, name, description, raster_key, is_active, is_public, srid, proj4 from gis.rasters where raster_id=$1::text', [params.id])
|
|
19
|
+
? await pg.query('select raster_id, source_path, name, description, raster_key, is_active, is_public, srid, proj4, geom from gis.rasters where raster_id=$1::text', [params.id])
|
|
20
20
|
.then(el => el.rows?.[0] || {})
|
|
21
21
|
: {};
|
|
22
22
|
|
|
@@ -42,6 +42,10 @@ export default async function rasterInfo({
|
|
|
42
42
|
return { data, cache, raster };
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
if (!raster.geom && Array.isArray(data?.extent)) {
|
|
46
|
+
await pg.query(`update gis.rasters set geom = ST_MakeEnvelope(${data.extent.join(',')}) where raster_id = $1`, [raster.raster_id]);
|
|
47
|
+
}
|
|
48
|
+
|
|
45
49
|
return {
|
|
46
50
|
time: Date.now() - time,
|
|
47
51
|
...data || {},
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { pgClients } from "@opengis/fastify-table/utils.js";
|
|
2
2
|
|
|
3
|
-
export default async function cartoBounds({
|
|
3
|
+
export default async function cartoBounds({
|
|
4
|
+
id, dataset, table, sql,
|
|
5
|
+
}, pg = pgClients.client) {
|
|
4
6
|
if (!dataset?.length && !table) {
|
|
5
7
|
return [-180, -85.05112877980659, 180, 85.05112877980659];
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
const sqlBounds = dataset
|
|
9
|
-
? dataset.map(el => ({ tbl: el.table.replace(/"/g, "").split('.'), geom: el.gcol || 'geom' })).map(({ tbl, geom }) => `select ST_Transform(ST_SetSRID( ST_EstimatedExtent('${tbl[0]}','${tbl[1]}', '${geom}'), (SELECT st_srid(${geom}) from ${tbl[0]}."${tbl[1]}" limit 1)),4326)`)
|
|
11
|
+
? dataset.filter((el, idx, arr) => el.table && arr.findIndex(item => item.table === el.table) === idx).map(el => ({ tbl: el.table.replace(/"/g, "").split('.'), geom: el.gcol || 'geom' })).map(({ tbl, geom }) => `select ST_Transform(ST_SetSRID( ST_EstimatedExtent('${tbl[0]}','${tbl[1]}', '${geom}'), (SELECT st_srid(${geom}) from ${tbl[0]}."${tbl[1]}" limit 1)),4326)`)
|
|
10
12
|
: [`select ST_Transform(ST_SetSRID(ST_EstimatedExtent('${table.replace(/"/g, "").split('.')[0]}', '${table.replace(/"/g, "").split('.')[1]}', 'geom'),(SELECT st_srid(geom) from ${table.split('.')[0]}."${table.split('.')[1]}" limit 1)),4326)`];
|
|
11
13
|
|
|
14
|
+
if (sql) return sqlBounds.join(' \nunion all\n ');
|
|
15
|
+
|
|
12
16
|
const geom = await pg.query(
|
|
13
17
|
`update gis.cartocss set
|
|
14
18
|
geom=(select st_extent(st_transform) from ( ${sqlBounds.join(' union all ')})q )
|