@opengis/gis 0.2.171 → 0.2.173
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-DrNd-2PW.js → CardIcon-Cg8bUM4G.js} +1 -1
- package/dist/{EntityTablePage-CERD3KWs.js → EntityTablePage-DHQGlLRk.js} +1 -1
- package/dist/{ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-3IWWtgKt.js → ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-BIL1ocLY.js} +1 -1
- package/dist/{HeaderActions.vue_vue_type_script_setup_true_lang-D_BESZDN.js → HeaderActions.vue_vue_type_script_setup_true_lang-Buff9gTO.js} +1 -1
- package/dist/{MapSettings-Dlo25naH.js → MapSettings-De-z7r5t.js} +1 -1
- package/dist/{RastersTablePage-BB5DAQ9o.js → RastersTablePage-Cdgkri9K.js} +1 -1
- package/dist/{cartocss-DmNfkX6X.js → cartocss-BT50SVhy.js} +5 -5
- package/dist/{import-utils-Dp6H-Ajf.js → import-utils-CMWiuRPp.js} +1 -1
- package/dist/{index-BaB3A3Tb.js → index-CHFLgCGW.js} +688 -678
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +19 -19
- package/dist/{raster-GtCFqtk-.js → raster-dSEb1SIG.js} +3 -3
- package/dist/{register-BQEx0elz.js → register-D7Puupgo.js} +3 -3
- package/dist/{service-CgO3RsDo.js → service-Cz6T0O3Z.js} +5 -5
- package/dist/{vs-datatable-B3hGBtGc.js → vs-datatable-DqVncrSg.js} +1 -1
- package/package.json +1 -1
- package/server/plugins/mapnik/funcs/checkRasterFile.js +1 -1
- package/server/routes/mapnik/functions/createXml.js +20 -8
- package/server/routes/mapnik/mapnik.route.js +1 -1
- package/server/routes/mapnik/mapnik.schema.mjs +5 -0
- package/server/routes/registers/functions/map.registry.js +20 -12
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineComponent as te, resolveDirective as We, openBlock as u, createElementBlock as m, createElementVNode as n, Fragment as W, renderList as X, toDisplayString as d, withDirectives as we, createTextVNode as Xe, normalizeClass as ae, ref as $, watch as S, computed as h, vModelText as Ke, onMounted as Ye, onBeforeUnmount as Ze, createCommentVNode as q, createVNode as B, withCtx as He, createBlock as F, resolveDynamicComponent as Je } from "vue";
|
|
2
2
|
import { useRouter as et, useRoute as tt } from "vue-router";
|
|
3
3
|
import { TooltipDirective as st, notify as M } from "@opengis/core";
|
|
4
|
-
import { _ as nt, u as lt, f as rt, M as ot, i as it, j as be, F as at } from "./index-
|
|
5
|
-
import { _ as ut, a as ct, b as dt, c as ft } from "./HeaderActions.vue_vue_type_script_setup_true_lang-
|
|
6
|
-
import { _ as he } from "./ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-
|
|
4
|
+
import { _ as nt, u as lt, f as rt, M as ot, i as it, j as be, F as at } from "./index-CHFLgCGW.js";
|
|
5
|
+
import { _ as ut, a as ct, b as dt, c as ft } from "./HeaderActions.vue_vue_type_script_setup_true_lang-Buff9gTO.js";
|
|
6
|
+
import { _ as he } from "./ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-BIL1ocLY.js";
|
|
7
7
|
const mt = { class: "flex-1 overflow-y-auto p-4 sm:p-6" }, pt = { class: "space-y-3" }, gt = { class: "bg-white p-3 rounded-xl border border-gray-200 shadow-sm" }, yt = { class: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2" }, vt = { class: "text-xs text-gray-500 mb-1" }, xt = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "text-base text-md font-semibold text-gray-900"
|
|
@@ -2,9 +2,9 @@ import { defineComponent as B, mergeModels as j, useModel as S, computed as h, d
|
|
|
2
2
|
import { useRoute as Z, useRouter as ee } from "vue-router";
|
|
3
3
|
import { notify as F } from "@opengis/core";
|
|
4
4
|
import { _ as te } from "./TableFormHeader.vue_vue_type_script_setup_true_lang-Mci_tseM.js";
|
|
5
|
-
import { V as N } from "./vs-datatable-
|
|
6
|
-
import { _ as z, n as R, m as E, r as H } from "./import-utils-
|
|
7
|
-
import { a as ae, b as le, c as se, d as oe, e as ie } from "./index-
|
|
5
|
+
import { V as N } from "./vs-datatable-DqVncrSg.js";
|
|
6
|
+
import { _ as z, n as R, m as E, r as H } from "./import-utils-CMWiuRPp.js";
|
|
7
|
+
import { a as ae, b as le, c as se, d as oe, e as ie } from "./index-CHFLgCGW.js";
|
|
8
8
|
import { LucideChevronRight as re } from "lucide-vue-next";
|
|
9
9
|
import { _ as ne } from "./MapSettingsTabs.vue_vue_type_script_setup_true_lang-CKCK3NqY.js";
|
|
10
10
|
const ue = { class: "vs-form" }, de = { class: "vs-form__body auto-rows-max container" }, ce = { class: "flex flex-wrap" }, me = { class: "h-fit w-full mb-6 bg-white border border-gray-200 rounded-lg p-6" }, ve = { class: "h-fit w-full flex flex-wrap" }, pe = { class: "w-full" }, fe = /* @__PURE__ */ B({
|
|
@@ -4,12 +4,12 @@ var L = (e, n, t) => pi(e, typeof n != "symbol" ? n + "" : n, t);
|
|
|
4
4
|
import { openBlock as _, createElementBlock as M, createElementVNode as g, defineComponent as ae, ref as E, watch as $, createTextVNode as mi, createVNode as D, createBlock as P, createCommentVNode as W, defineAsyncComponent as hi, unref as ze, withCtx as bn, withDirectives as fn, vModelText as dn, normalizeClass as _e, Fragment as kt, renderList as At, toDisplayString as fe, getCurrentInstance as Ct, onBeforeUnmount as wt, toRef as gi, computed as ve, onMounted as yi, resolveDynamicComponent as vi } from "vue";
|
|
5
5
|
import { useRoute as bi, useRouter as xi } from "vue-router";
|
|
6
6
|
import { notify as X } from "@opengis/core";
|
|
7
|
-
import { _ as Xe, u as Ge, f as Si, M as ki, g as Ai, h as Ci, i as wi, j as tt, k as Ti, l as _i, m as Ei, s as it, n as Ii } from "./index-
|
|
8
|
-
import { _ as Ni, a as $i, b as Li, c as Fi } from "./HeaderActions.vue_vue_type_script_setup_true_lang-
|
|
9
|
-
import { S as Oi, C as Ri } from "./CardIcon-
|
|
7
|
+
import { _ as Xe, u as Ge, f as Si, M as ki, g as Ai, h as Ci, i as wi, j as tt, k as Ti, l as _i, m as Ei, s as it, n as Ii } from "./index-CHFLgCGW.js";
|
|
8
|
+
import { _ as Ni, a as $i, b as Li, c as Fi } from "./HeaderActions.vue_vue_type_script_setup_true_lang-Buff9gTO.js";
|
|
9
|
+
import { S as Oi, C as Ri } from "./CardIcon-Cg8bUM4G.js";
|
|
10
10
|
import { _ as Tt } from "./MonacoEditor.vue_vue_type_script_setup_true_lang-D3ZPeXMw.js";
|
|
11
|
-
import { V as Ze } from "./vs-datatable-
|
|
12
|
-
import { _ as Nn, m as $n, r as $e } from "./import-utils-
|
|
11
|
+
import { V as Ze } from "./vs-datatable-DqVncrSg.js";
|
|
12
|
+
import { _ as Nn, m as $n, r as $e } from "./import-utils-CMWiuRPp.js";
|
|
13
13
|
/*! js-yaml 5.2.1 https://github.com/nodeca/js-yaml @license MIT */
|
|
14
14
|
var T = Symbol("NOT_RESOLVED"), Ln = Symbol("MERGE_KEY");
|
|
15
15
|
function U(e, n) {
|
|
@@ -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-CHFLgCGW.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,14 +1,14 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
|
|
3
3
|
import { config, pgClients } from '@opengis/fastify-table/utils.js';
|
|
4
|
+
import { BadRequestError, NotImplementedError } from '@opengis/fastify-table/errors.js';
|
|
4
5
|
|
|
5
6
|
import mapnik from '../../../plugins/mapnik/funcs/mapnik.js';
|
|
6
|
-
import { BadRequestError, NotFoundError, NotImplementedError } from '@opengis/fastify-table/errors.js';
|
|
7
7
|
|
|
8
8
|
const { GetRasterStatus, CreateXML } = mapnik();
|
|
9
9
|
|
|
10
10
|
export default async function createXml({
|
|
11
|
-
id, vrt, debug, nocache, callback = () => { },
|
|
11
|
+
id, vrt, srid, proj4: queryProj4, debug, nocache, callback = () => { },
|
|
12
12
|
}, pg = pgClients.client) {
|
|
13
13
|
if (!GetRasterStatus || !CreateXML) {
|
|
14
14
|
throw NotImplementedError('mapnik server address needed');
|
|
@@ -24,18 +24,30 @@ export default async function createXml({
|
|
|
24
24
|
: null;
|
|
25
25
|
|
|
26
26
|
if (!data?.id) {
|
|
27
|
-
throw NotFoundError('raster not found')
|
|
27
|
+
// throw NotFoundError('raster not found');
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
if (!data
|
|
30
|
+
if (data && !data?.source_path) {
|
|
31
31
|
throw BadRequestError('raster source_path not set');
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
const sourcePath = data?.id ? data.source_path : Buffer.from(id, "base64").toString("utf-8");
|
|
35
|
+
|
|
36
|
+
const extension = path.extname(sourcePath)?.toLowerCase();
|
|
37
|
+
|
|
38
|
+
if (!data && (!extension || !extension.match(/^(\.tif|\.tiff)$/i))) {
|
|
39
|
+
throw BadRequestError('invalid params: id');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!data && !(srid || queryProj4)) {
|
|
43
|
+
// throw BadRequestError('not enough query params: srid/proj4');
|
|
44
|
+
}
|
|
45
|
+
|
|
34
46
|
// const relpath = `/map/raster/${data.source_path}`;
|
|
35
|
-
const relpath = ['raster', config.mapnik?.folder,
|
|
47
|
+
const relpath = ['raster', config.mapnik?.folder, sourcePath].filter(Boolean).join('/');
|
|
36
48
|
|
|
37
49
|
// check raster upload status, skip for directories
|
|
38
|
-
const uploadStatus =
|
|
50
|
+
const uploadStatus = extension ? await GetRasterStatus({ path: relpath }) : {};
|
|
39
51
|
|
|
40
52
|
if (uploadStatus.exists === false) {
|
|
41
53
|
throw BadRequestError('raster not uploaded');
|
|
@@ -45,13 +57,13 @@ export default async function createXml({
|
|
|
45
57
|
throw BadRequestError('upload not finished');
|
|
46
58
|
}
|
|
47
59
|
|
|
48
|
-
const proj4 = data
|
|
60
|
+
const proj4 = queryProj4 || (data?.srid && pg.pk?.['public.spatial_ref_sys'] ? await pg.query('select proj4text from public.spatial_ref_sys where srid=$1', [srid || data?.srid]).then(r => r.rows?.[0]?.proj4text) : undefined);
|
|
49
61
|
|
|
50
62
|
// create at xml/:id with name only, always - by path
|
|
51
63
|
const resp = await CreateXML({
|
|
52
64
|
path: relpath,
|
|
53
65
|
name: [config.mapnik?.folder, id].filter(Boolean).join('/'), // create additional xml named as primary key at xml directory
|
|
54
|
-
previewZoom: data
|
|
66
|
+
previewZoom: data?.raster_zoom, // preview<=>detailed, default = 16 if file size > 1GB
|
|
55
67
|
// srid: data.srid, // auto detected if not supplied
|
|
56
68
|
proj4,
|
|
57
69
|
vrt, // force vrt even if relpath leads to single raster file
|
|
@@ -38,7 +38,7 @@ export default function route(app) {
|
|
|
38
38
|
});
|
|
39
39
|
app.get('/gis-xml/:id', { ...publicParams, schema: gisXmlSchema }, async ({ params, query }, reply) => {
|
|
40
40
|
const callback = process.env.NODE_ENV === 'test' || process.env.VITEST ? console.log : eventStream(reply);
|
|
41
|
-
const result = await createXml({ id: params.id, vrt: query.vrt, debug: query.debug, nocache: query.nocache, callback }).catch(err => ({ error: err.toString() }));
|
|
41
|
+
const result = await createXml({ id: params.id, srid: query.srid, proj4: query.proj4, vrt: query.vrt, debug: query.debug, nocache: query.nocache, callback }).catch(err => ({ error: err.toString() }));
|
|
42
42
|
callback(result?.error || 'finish', true);
|
|
43
43
|
return result;
|
|
44
44
|
});
|
|
@@ -51,6 +51,11 @@ export const gisXmlSchema = {
|
|
|
51
51
|
nocache: { type: "string", enum: ['true', '1'] },
|
|
52
52
|
vrt: { type: "string", enum: ['true', '1'] },
|
|
53
53
|
debug: { type: "number", minimum: 1, maximum: 10 },
|
|
54
|
+
srid: { type: "number", minimum: 1, maximum: 1000000 },
|
|
55
|
+
proj4: {
|
|
56
|
+
type: "string", minLength: 1,
|
|
57
|
+
maxLength: 4096
|
|
58
|
+
},
|
|
54
59
|
},
|
|
55
60
|
},
|
|
56
61
|
};
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { pgClients, getFilterSQL, getTemplate } from "@opengis/fastify-table/utils.js";
|
|
2
|
-
import { attachClassifiers } from './funcs/classifiers.js';
|
|
3
|
-
const pg = pgClients.client;
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
const { params = {}, query = {} } = req;
|
|
7
|
-
const { slug, id } = params;
|
|
8
|
-
const { filter, page = 1 } = query;
|
|
3
|
+
import { BadRequestError, NotFoundError } from "@opengis/fastify-table/errors.js";
|
|
9
4
|
|
|
10
|
-
|
|
5
|
+
import { attachClassifiers } from './classifiers.js';
|
|
6
|
+
|
|
7
|
+
export default async function mapRegistry({
|
|
8
|
+
slug, id, filter, limit: queryLimit, page = 1
|
|
9
|
+
}, pg = pgClients.client) {
|
|
10
|
+
if (!slug || !id) {
|
|
11
|
+
throw BadRequestError('Params slug and id is required');
|
|
12
|
+
}
|
|
11
13
|
|
|
12
14
|
const mapTemplate = await getTemplate('map', slug);
|
|
13
|
-
|
|
15
|
+
|
|
16
|
+
if (!mapTemplate) {
|
|
17
|
+
throw NotFoundError('Template not found');
|
|
18
|
+
}
|
|
14
19
|
|
|
15
20
|
const listWidget = mapTemplate.widgets?.find(w => w.type === 'list' && w.visible !== false && w.id === id);
|
|
16
|
-
|
|
21
|
+
|
|
22
|
+
if (!listWidget) {
|
|
23
|
+
throw NotFoundError('List widget not found');
|
|
24
|
+
}
|
|
17
25
|
|
|
18
26
|
const {
|
|
19
27
|
table,
|
|
@@ -25,7 +33,7 @@ const { params = {}, query = {} } = req;
|
|
|
25
33
|
} = listWidget;
|
|
26
34
|
|
|
27
35
|
const { columns = [], filters = [], limit: configLimit = 20 } = config;
|
|
28
|
-
const limit =
|
|
36
|
+
const limit = queryLimit || configLimit;
|
|
29
37
|
const offset = limit * (page - 1);
|
|
30
38
|
const selectColumns = columns.map(col => col.name);
|
|
31
39
|
|
|
@@ -35,7 +43,7 @@ const { params = {}, query = {} } = req;
|
|
|
35
43
|
|
|
36
44
|
|
|
37
45
|
const { q: sqlFilter } = filter
|
|
38
|
-
? await getFilterSQL({ table, filter
|
|
46
|
+
? await getFilterSQL({ table, filter })
|
|
39
47
|
: { q: '1=1' };
|
|
40
48
|
|
|
41
49
|
const whereConditions = [baseQuery, sqlFilter].filter(Boolean).join(" AND ");
|
|
@@ -43,7 +51,7 @@ const { params = {}, query = {} } = req;
|
|
|
43
51
|
|
|
44
52
|
const sqlBase = `FROM ${table} ${whereClause}`;
|
|
45
53
|
const sqlOrder = order ? `ORDER BY ${order}` : "";
|
|
46
|
-
const sqlLimit = `LIMIT $1 OFFSET $2`;
|
|
54
|
+
const sqlLimit = `LIMIT $1::bigint OFFSET $2::bigint`;
|
|
47
55
|
const sqlSelect = `SELECT ${pk} as id, ${selectColumns.join(", ")}
|
|
48
56
|
${sqlBase}`;
|
|
49
57
|
const dataQuery = `${sqlSelect} ${sqlOrder} ${sqlLimit}`;
|