@golemio/mvt-maps 0.0.1-dev.1826529834

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.
Files changed (34) hide show
  1. package/LICENSE +11 -0
  2. package/README.md +46 -0
  3. package/db/example/sql_dump.sql +47 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +29 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/output-gateway/controllers/V2MvtController.d.ts +8 -0
  8. package/dist/output-gateway/controllers/V2MvtController.js +69 -0
  9. package/dist/output-gateway/controllers/V2MvtController.js.map +1 -0
  10. package/dist/output-gateway/index.d.ts +2 -0
  11. package/dist/output-gateway/index.js +6 -0
  12. package/dist/output-gateway/index.js.map +1 -0
  13. package/dist/output-gateway/ioc/Di.d.ts +3 -0
  14. package/dist/output-gateway/ioc/Di.js +17 -0
  15. package/dist/output-gateway/ioc/Di.js.map +1 -0
  16. package/dist/output-gateway/ioc/ModuleContainerToken.d.ts +5 -0
  17. package/dist/output-gateway/ioc/ModuleContainerToken.js +11 -0
  18. package/dist/output-gateway/ioc/ModuleContainerToken.js.map +1 -0
  19. package/dist/output-gateway/routers/V2MvtRouter.d.ts +3 -0
  20. package/dist/output-gateway/routers/V2MvtRouter.js +34 -0
  21. package/dist/output-gateway/routers/V2MvtRouter.js.map +1 -0
  22. package/dist/output-gateway/routers/constants.d.ts +3 -0
  23. package/dist/output-gateway/routers/constants.js +8 -0
  24. package/dist/output-gateway/routers/constants.js.map +1 -0
  25. package/dist/output-gateway/routers/interfaces/IMvtParams.d.ts +10 -0
  26. package/dist/output-gateway/routers/interfaces/IMvtParams.js +3 -0
  27. package/dist/output-gateway/routers/interfaces/IMvtParams.js.map +1 -0
  28. package/dist/output-gateway/services/MvtClusterService.d.ts +10 -0
  29. package/dist/output-gateway/services/MvtClusterService.js +91 -0
  30. package/dist/output-gateway/services/MvtClusterService.js.map +1 -0
  31. package/docs/implementation_documentation.md +33 -0
  32. package/docs/index.md +3 -0
  33. package/docs/openapi-output.yaml +140 -0
  34. package/package.json +77 -0
package/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Operátor ICT, a.s.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10
+
11
+ Source: http://opensource.org/licenses/MIT
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ <div align="center">
2
+ <p>
3
+ <a href="https://operatorict.cz">
4
+ <img src="https://gitlab.com/operator-ict/golemio/code/modules/core/-/raw/development/.assets/oict_logo.png" alt="oict" width="100px" height="100px" />
5
+ </a>
6
+ <a href="https://golemio.cz">
7
+ <img src="https://gitlab.com/operator-ict/golemio/code/modules/core/-/raw/development/.assets/golemio_logo.png" alt="golemio" width="100px" height="100px" />
8
+ </a>
9
+ </p>
10
+
11
+ <h1>@golemio/mvt-maps</h1>
12
+
13
+ <p>
14
+ <a href="https://gitlab.com/operator-ict/golemio/code/modules/mvt-maps/commits/master">
15
+ <img src="https://gitlab.com/operator-ict/golemio/code/modules/mvt-maps/badges/master/pipeline.svg" alt="pipeline">
16
+ </a>
17
+ <a href="https://gitlab.com/operator-ict/golemio/code/modules/mvt-maps/commits/master">
18
+ <img src="https://gitlab.com/operator-ict/golemio/code/modules/mvt-maps/badges/master/coverage.svg" alt="coverage">
19
+ </a>
20
+ <a href="./LICENSE">
21
+ <img src="https://img.shields.io/npm/l/@golemio/mvt-maps" alt="license">
22
+ </a>
23
+ </p>
24
+
25
+ <p>
26
+ <a href="#installation">Installation</a> · <a href="./docs">Documentation</a> · <a href="https://operator-ict.gitlab.io/golemio/code/modules/mvt-maps">TypeDoc</a>
27
+ </p>
28
+ </div>
29
+
30
+ This module is intended for use with Golemio services. Refer [here](https://gitlab.com/operator-ict/golemio/code/modules/core/-/blob/development/README.md) for further information on usage, local development and more.
31
+
32
+ ## Installation
33
+
34
+ The APIs may be unstable. Therefore, we recommend installing this module as an exact version.
35
+
36
+ ```bash
37
+ # Latest version
38
+ npm install --save-exact @golemio/mvt-maps@latest
39
+
40
+ # Development version
41
+ npm install --save-exact @golemio/mvt-maps@dev
42
+ ```
43
+
44
+ <!-- ## Description -->
45
+
46
+ <!-- Insert module-specific info here -->
@@ -0,0 +1,47 @@
1
+ -- fake table for testing purposes
2
+
3
+ CREATE SCHEMA IF NOT EXISTS test;
4
+
5
+ CREATE TABLE test.vehicle_status (
6
+ id text NOT NULL,
7
+ system_id varchar(50) NOT NULL,
8
+ point public.geometry NULL,
9
+ helmets int4 NULL,
10
+ passengers int4 NULL,
11
+ damage_description text NULL,
12
+ description text NULL,
13
+ vehicle_registration text NULL,
14
+ is_reserved bool NOT NULL,
15
+ is_disabled bool NOT NULL,
16
+ vehicle_type_id text NOT NULL,
17
+ last_reported timestamptz NULL,
18
+ current_range_meters float8 NULL,
19
+ charge_percent int4 NULL,
20
+ rental_app_id varchar(50) NULL,
21
+ station_id text NULL,
22
+ create_batch_id int8 NULL,
23
+ created_at timestamptz NULL,
24
+ created_by varchar(150) NULL,
25
+ update_batch_id int8 NULL,
26
+ updated_at timestamptz NULL,
27
+ updated_by varchar(150) NULL,
28
+ pricing_plan_id varchar(50) NULL,
29
+ make varchar(50) NULL,
30
+ model varchar(50) NULL,
31
+ color varchar(50) NULL,
32
+ processed_at timestamptz DEFAULT '1970-01-01 01:00:00+01'::timestamp with time zone NOT NULL
33
+ );
34
+
35
+ WITH init_values AS (
36
+ SELECT CAST(current_date - INTERVAL '1 day' + INTERVAL '10 hour' AS TIMESTAMPTZ) AT TIME ZONE 'Europe/Prague' AS start_datetime
37
+ )
38
+ INSERT INTO test.vehicle_status (id,system_id,point,helmets,passengers,damage_description,description,vehicle_registration,is_reserved,is_disabled,vehicle_type_id,last_reported,current_range_meters,charge_percent,rental_app_id,station_id,create_batch_id,created_at,created_by,update_batch_id,updated_at,updated_by,pricing_plan_id,make,model,color,processed_at)
39
+ VALUES
40
+ ('hoppygo-13910','ef63ac2e-4c71-4c28-a496-f0dc010d630b','SRID=4326;POINT (14.423982 50.074558)',NULL,NULL,NULL,'Peugeot 207',NULL,false,false,'hoppygo_car_combustion',(SELECT start_datetime FROM init_values),NULL,NULL,'hoppygo_rental_apps',NULL,NULL,'2023-03-07 13:24:15.923',NULL,NULL,'2023-03-21 10:52:13.997',NULL,'hoppygo_individual_rides_13910','Peugeot','207',NULL,NOW()),
41
+ ('hoppygo-9943','ef63ac2e-4c71-4c28-a496-f0dc010d630b','SRID=4326;POINT (18.29234 49.839294)',NULL,NULL,NULL,'Ostatní Other',NULL,false,false,'hoppygo_car_electric',(SELECT start_datetime FROM init_values),NULL,NULL,'hoppygo_rental_apps',NULL,NULL,'2022-08-25 10:22:10.339',NULL,NULL,'2023-03-21 10:52:13.997',NULL,'hoppygo_individual_rides_9943','Ostatní','Other',NULL,NOW()),
42
+ ('cesky-carsharing-1BF8202','ajo','SRID=4326;POINT (14.4099 50.0731)',NULL,NULL,NULL,'Fabia III kombi ','1BF8202',false,false,'carsharing_benzin_LPG',(SELECT start_datetime FROM init_values),NULL,NULL,'ajo_rental_apps',NULL,NULL,'2022-11-08 15:00:20.813',NULL,NULL,'2023-03-21 10:54:04.878',NULL,'ajo_tarif_top','Škoda','Fabia III kombi',NULL,NOW()),
43
+ ('cesky-carsharing-1BF8203','ajo','SRID=4326;POINT (14.4423 50.0906)',NULL,NULL,NULL,'Fabia III kombi ','1BF8203',false,false,'carsharing_benzin_LPG',(SELECT start_datetime FROM init_values),NULL,NULL,'ajo_rental_apps',NULL,NULL,'2022-11-08 15:00:20.813',NULL,NULL,'2023-03-21 10:54:04.878',NULL,'ajo_tarif_top','Škoda','Fabia III kombi',NULL,NOW()),
44
+ ('cesky-carsharing-1BF8207','ajo','SRID=4326;POINT (14.4711 50.1324)',NULL,NULL,NULL,'Fabia III kombi ','1BF8207',false,false,'carsharing_benzin_LPG',(SELECT start_datetime FROM init_values),NULL,NULL,'ajo_rental_apps',NULL,NULL,'2022-11-08 15:00:20.813',NULL,NULL,'2023-03-21 10:54:04.878',NULL,'ajo_tarif_top','Škoda','Fabia III kombi',NULL,NOW()),
45
+ ('cesky-carsharing-1BF8210','ajo','SRID=4326;POINT (14.4579 50.0793)',NULL,NULL,NULL,'Fabia III kombi ','1BF8210',false,false,'carsharing_benzin_LPG',(SELECT start_datetime FROM init_values),NULL,NULL,'ajo_rental_apps',NULL,NULL,'2022-11-08 15:00:20.862',NULL,NULL,'2023-03-21 10:54:04.878',NULL,'ajo_tarif_top','Škoda','Fabia III kombi',NULL,NOW()),
46
+ ('cesky-carsharing-1BF8211','ajo','SRID=4326;POINT (14.4579 50.0793)',NULL,NULL,NULL,'Fabia III kombi ','1BF8211',false,false,'carsharing_benzin_LPG',(SELECT start_datetime FROM init_values),NULL,NULL,'mobility-operator-app-hoppygo',NULL,NULL,'2022-11-08 15:00:20.862',NULL,NULL,'2023-03-21 10:54:04.878',NULL,'ajo_tarif_top','Škoda','Fabia III kombi',NULL,NOW())
47
+ ON CONFLICT DO NOTHING;
@@ -0,0 +1 @@
1
+ export * as OutputGateway from "./output-gateway/index";
package/dist/index.js ADDED
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.OutputGateway = void 0;
27
+ // Library exports
28
+ exports.OutputGateway = __importStar(require("./output-gateway/index"));
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAkB;AAClB,wEAA2C"}
@@ -0,0 +1,8 @@
1
+ import { NextFunction, Request, Response } from "@golemio/core/dist/shared/express";
2
+ import { MvtClusterService } from "../services/MvtClusterService";
3
+ export declare class V2MvtController {
4
+ private service;
5
+ constructor(service: MvtClusterService);
6
+ getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
7
+ private parseParams;
8
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.V2MvtController = void 0;
25
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
26
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
27
+ const ModuleContainerToken_1 = require("../ioc/ModuleContainerToken");
28
+ const MvtClusterService_1 = require("../services/MvtClusterService");
29
+ let V2MvtController = exports.V2MvtController = class V2MvtController {
30
+ constructor(service) {
31
+ this.service = service;
32
+ this.getAll = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
33
+ try {
34
+ const params = this.parseParams(req);
35
+ const result = yield this.service.getTile(params.table, params.geometry, params.x, params.y, params.z, params.maxZoom, params.attributes, params.radius);
36
+ res.setHeader("Content-Type", "application/vnd.mapbox-vector-tile");
37
+ res.status(200).send(result);
38
+ }
39
+ catch (err) {
40
+ next(err);
41
+ }
42
+ });
43
+ }
44
+ parseParams(req) {
45
+ try {
46
+ return {
47
+ x: parseInt(req.params.x),
48
+ y: parseInt(req.params.y),
49
+ z: parseInt(req.params.z),
50
+ table: req.query.table,
51
+ geometry: req.query.geometry,
52
+ attributes: Array.isArray(req.query.attributes)
53
+ ? req.query.attributes
54
+ : [req.query.attributes],
55
+ radius: req.query.radius ? parseInt(req.query.radius) : undefined,
56
+ maxZoom: parseInt(req.query.maxZoom),
57
+ };
58
+ }
59
+ catch (err) {
60
+ throw new golemio_errors_1.GeneralError("Param parsing error", this.constructor.name, err, 500);
61
+ }
62
+ }
63
+ };
64
+ exports.V2MvtController = V2MvtController = __decorate([
65
+ (0, tsyringe_1.injectable)(),
66
+ __param(0, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.MvtClusterService)),
67
+ __metadata("design:paramtypes", [MvtClusterService_1.MvtClusterService])
68
+ ], V2MvtController);
69
+ //# sourceMappingURL=V2MvtController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"V2MvtController.js","sourceRoot":"","sources":["../../../src/output-gateway/controllers/V2MvtController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,6EAAwE;AACxE,iEAAwE;AAExE,sEAAoE;AACpE,qEAAmE;AAG5D,IAAM,eAAe,6BAArB,MAAM,eAAe;IACxB,YAA4D,OAAkC;QAA1B,YAAO,GAAP,OAAO,CAAmB;QAEvF,WAAM,GAAG,CAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;YACtE,IAAI;gBACA,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;gBACrC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CACrC,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,QAAQ,EACf,MAAM,CAAC,CAAC,EACR,MAAM,CAAC,CAAC,EACR,MAAM,CAAC,CAAC,EACR,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,MAAM,CAChB,CAAC;gBAEF,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,oCAAoC,CAAC,CAAC;gBACpE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aAChC;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,GAAG,CAAC,CAAC;aACb;QACL,CAAC,CAAA,CAAC;IArB+F,CAAC;IAuB1F,WAAW,CAAC,GAAY;QAC5B,IAAI;YACA,OAAO;gBACH,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAW,CAAC;gBACnC,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAW,CAAC;gBACnC,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAW,CAAC;gBACnC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,KAAe;gBAChC,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,QAAkB;gBACtC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC;oBAC3C,CAAC,CAAE,GAAG,CAAC,KAAK,CAAC,UAAuB;oBACpC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,UAAoB,CAAC;gBACtC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,MAAgB,CAAC,CAAC,CAAC,CAAC,SAAS;gBAC3E,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,OAAiB,CAAC;aACjD,CAAC;SACL;QAAC,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,6BAAY,CAAC,qBAAqB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;SAClF;IACL,CAAC;CACJ,CAAA;0BA1CY,eAAe;IAD3B,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,iBAAiB,CAAC,CAAA;qCAAkB,qCAAiB;GADrF,eAAe,CA0C3B"}
@@ -0,0 +1,2 @@
1
+ import { AbstractRouter } from "@golemio/core/dist/helpers/routing/AbstractRouter";
2
+ export declare const routers: AbstractRouter[];
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.routers = void 0;
4
+ const V2MvtRouter_1 = require("./routers/V2MvtRouter");
5
+ exports.routers = [V2MvtRouter_1.v2MvtRouter];
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/output-gateway/index.ts"],"names":[],"mappings":";;;AAAA,uDAAsD;AAGzC,QAAA,OAAO,GAAqB,CAAC,yBAAW,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { DependencyContainer } from "@golemio/core/dist/shared/tsyringe";
2
+ declare const mvtContainer: DependencyContainer;
3
+ export { mvtContainer as MvtContainer };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MvtContainer = void 0;
4
+ const Di_1 = require("@golemio/core/dist/output-gateway/ioc/Di");
5
+ const ModuleContainerToken_1 = require("./ModuleContainerToken");
6
+ const V2MvtController_1 = require("../controllers/V2MvtController");
7
+ const MvtClusterService_1 = require("../services/MvtClusterService");
8
+ //#region Initialization
9
+ const mvtContainer = Di_1.OutputGatewayContainer.createChildContainer();
10
+ exports.MvtContainer = mvtContainer;
11
+ //#endregion
12
+ //#region Controllers
13
+ mvtContainer.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.V2MvtController, V2MvtController_1.V2MvtController);
14
+ //#endregion
15
+ //#region Services
16
+ mvtContainer.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.MvtClusterService, MvtClusterService_1.MvtClusterService);
17
+ //# sourceMappingURL=Di.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../src/output-gateway/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,iEAAkF;AAElF,iEAA8D;AAC9D,oEAAkE;AAClE,qEAAmE;AAEnE,wBAAwB;AACxB,MAAM,YAAY,GAAwB,2BAAsB,CAAC,oBAAoB,EAAE,CAAC;AAW/D,oCAAY;AAVrC,YAAY;AAEZ,qBAAqB;AACrB,YAAY,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,eAAe,EAAE,iCAAe,CAAC,CAAC;AACtF,YAAY;AAEZ,kBAAkB;AAClB,YAAY,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,iBAAiB,EAAE,qCAAiB,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ declare const ModuleContainerToken: {
2
+ V2MvtController: symbol;
3
+ MvtClusterService: symbol;
4
+ };
5
+ export { ModuleContainerToken };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModuleContainerToken = void 0;
4
+ const ModuleContainerToken = {
5
+ // Controllers
6
+ V2MvtController: Symbol(),
7
+ // Services
8
+ MvtClusterService: Symbol(),
9
+ };
10
+ exports.ModuleContainerToken = ModuleContainerToken;
11
+ //# sourceMappingURL=ModuleContainerToken.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModuleContainerToken.js","sourceRoot":"","sources":["../../../src/output-gateway/ioc/ModuleContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,oBAAoB,GAAG;IACzB,cAAc;IACd,eAAe,EAAE,MAAM,EAAE;IAEzB,WAAW;IACX,iBAAiB,EAAE,MAAM,EAAE;CAC9B,CAAC;AAEO,oDAAoB"}
@@ -0,0 +1,3 @@
1
+ import { AbstractRouter } from "@golemio/core/dist/helpers/routing/AbstractRouter";
2
+ declare const v2MvtRouter: AbstractRouter;
3
+ export { v2MvtRouter };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.v2MvtRouter = void 0;
4
+ const Di_1 = require("../ioc/Di");
5
+ const ModuleContainerToken_1 = require("../ioc/ModuleContainerToken");
6
+ const AbstractRouter_1 = require("@golemio/core/dist/helpers/routing/AbstractRouter");
7
+ const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
8
+ const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
9
+ const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
10
+ const constants_1 = require("./constants");
11
+ class V2MvtRouter extends AbstractRouter_1.AbstractRouter {
12
+ constructor() {
13
+ super(constants_1.RouteVersion.v2, "mvt");
14
+ this.controller = Di_1.MvtContainer.resolve(ModuleContainerToken_1.ModuleContainerToken.V2MvtController);
15
+ this.cacheHeaderMiddleware = Di_1.MvtContainer.resolve(ioc_1.ContainerToken.CacheHeaderMiddleware);
16
+ this.initRoutes();
17
+ }
18
+ initRoutes() {
19
+ this.router.get("/:z/:x/:y", [
20
+ (0, express_validator_1.param)("x").exists().isInt().not().isArray(),
21
+ (0, express_validator_1.param)("y").exists().isInt().not().isArray(),
22
+ (0, express_validator_1.param)("z").exists().isInt().not().isArray(),
23
+ (0, express_validator_1.query)("table").exists().isString().not().isArray(),
24
+ (0, express_validator_1.query)("geometry").exists().isString().not().isArray(),
25
+ (0, express_validator_1.query)("attributes").exists(),
26
+ (0, express_validator_1.query)("attributes.*").exists().isString().not().isArray(),
27
+ (0, express_validator_1.query)("maxZoom").exists().isInt(),
28
+ (0, express_validator_1.query)("radius").optional().isInt(),
29
+ ], Validation_1.checkErrors, this.cacheHeaderMiddleware.getMiddleware(5 * 60, 60), this.controller.getAll);
30
+ }
31
+ }
32
+ const v2MvtRouter = new V2MvtRouter();
33
+ exports.v2MvtRouter = v2MvtRouter;
34
+ //# sourceMappingURL=V2MvtRouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"V2MvtRouter.js","sourceRoot":"","sources":["../../../src/output-gateway/routers/V2MvtRouter.ts"],"names":[],"mappings":";;;AAAA,kCAA0C;AAC1C,sEAAoE;AACpE,sFAAmF;AAEnF,+DAAuE;AACvE,6EAA2E;AAC3E,mFAA2E;AAC3E,2CAA2C;AAG3C,MAAM,WAAY,SAAQ,+BAAc;IAIpC;QACI,KAAK,CAAC,wBAAY,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QAE9B,IAAI,CAAC,UAAU,GAAG,iBAAY,CAAC,OAAO,CAAC,2CAAoB,CAAC,eAAe,CAAC,CAAC;QAC7E,IAAI,CAAC,qBAAqB,GAAG,iBAAY,CAAC,OAAO,CAAwB,oBAAc,CAAC,qBAAqB,CAAC,CAAC;QAC/G,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IAES,UAAU;QAChB,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,WAAW,EACX;YACI,IAAA,yBAAK,EAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;YAC3C,IAAA,yBAAK,EAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;YAC3C,IAAA,yBAAK,EAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;YAC3C,IAAA,yBAAK,EAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;YAClD,IAAA,yBAAK,EAAC,UAAU,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;YACrD,IAAA,yBAAK,EAAC,YAAY,CAAC,CAAC,MAAM,EAAE;YAC5B,IAAA,yBAAK,EAAC,cAAc,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;YACzD,IAAA,yBAAK,EAAC,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;YACjC,IAAA,yBAAK,EAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE;SACrC,EACD,wBAAW,EACX,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EACpD,IAAI,CAAC,UAAU,CAAC,MAAM,CACzB,CAAC;IACN,CAAC;CACJ;AAED,MAAM,WAAW,GAAmB,IAAI,WAAW,EAAE,CAAC;AAE7C,kCAAW"}
@@ -0,0 +1,3 @@
1
+ export declare enum RouteVersion {
2
+ v2 = "v2"
3
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RouteVersion = void 0;
4
+ var RouteVersion;
5
+ (function (RouteVersion) {
6
+ RouteVersion["v2"] = "v2";
7
+ })(RouteVersion || (exports.RouteVersion = RouteVersion = {}));
8
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/output-gateway/routers/constants.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAEX;AAFD,WAAY,YAAY;IACpB,yBAAS,CAAA;AACb,CAAC,EAFW,YAAY,4BAAZ,YAAY,QAEvB"}
@@ -0,0 +1,10 @@
1
+ export interface IMvtParams {
2
+ x: number;
3
+ y: number;
4
+ z: number;
5
+ table: string;
6
+ geometry: string;
7
+ attributes: string[];
8
+ radius?: number;
9
+ maxZoom: number;
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IMvtParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IMvtParams.js","sourceRoot":"","sources":["../../../../src/output-gateway/routers/interfaces/IMvtParams.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postgres/IDatabaseConnector";
2
+ import { ILogger } from "@golemio/core/dist/helpers";
3
+ export declare class MvtClusterService {
4
+ private connector;
5
+ private logger;
6
+ constructor(connector: IDatabaseConnector, logger: ILogger);
7
+ getTile(table: string, geometry: string, x: number, y: number, z: number, zoomLevel: number, attributes: string[], radius?: number): Promise<Uint8Array>;
8
+ private defaultGetBaseQuery;
9
+ private defaultGetTileQuery;
10
+ }
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.MvtClusterService = void 0;
25
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
26
+ const clusterbuster_1 = require("@golemio/clusterbuster");
27
+ const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
28
+ const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
29
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
30
+ let MvtClusterService = exports.MvtClusterService = class MvtClusterService {
31
+ constructor(connector, logger) {
32
+ this.connector = connector;
33
+ this.logger = logger;
34
+ this.defaultGetBaseQuery = ({ x, y, z, table, geometry, maxZoomLevel, attributes, query, }) => `
35
+ SELECT
36
+ ${geometry} AS center,
37
+ 1 AS size,
38
+ 0 AS clusterNo,
39
+ ${maxZoomLevel + 1} AS expansionZoom${attributes}
40
+ FROM ${table}
41
+ WHERE
42
+ ST_Intersects(TileBBox(${z}, ${x}, ${y}, 4326), ${geometry})
43
+ ${query.length > 0 ? `AND ${query.join(" AND ")}` : ""}
44
+ `;
45
+ this.defaultGetTileQuery = ({ x, y, z, table, geometry, extent, bufferSize, attributes }) => `
46
+ SELECT
47
+ ST_AsMVTGeom(${geometry}, TileBBox(${z}, ${x}, ${y}, 4326), ${extent}, ${bufferSize}, false) AS geom,
48
+ jsonb_build_object(
49
+ 'count', size,
50
+ 'expansionZoom', expansionZoom${attributes}
51
+ ) AS attributes
52
+ FROM ${table}
53
+ `;
54
+ }
55
+ getTile(table, geometry, x, y, z, zoomLevel, attributes, radius = 15) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const defaultConfig = {
58
+ sourceLayer: "points",
59
+ extent: 4096,
60
+ bufferSize: 256,
61
+ debug: false,
62
+ query: [],
63
+ getBaseQuery: this.defaultGetBaseQuery,
64
+ getTileQuery: this.defaultGetTileQuery,
65
+ };
66
+ const query = (0, clusterbuster_1.createQueryForTile)(Object.assign(Object.assign({}, defaultConfig), { z,
67
+ x,
68
+ y, maxZoomLevel: zoomLevel, table,
69
+ geometry,
70
+ radius,
71
+ attributes }));
72
+ try {
73
+ const result = yield this.connector.getConnection().query(query, {
74
+ type: sequelize_1.QueryTypes.SELECT,
75
+ });
76
+ return result[0].mvt;
77
+ }
78
+ catch (error) {
79
+ this.logger.error(error, `Error while getting tile: ${query}`);
80
+ throw new golemio_errors_1.GeneralError("Error while getting tile", this.constructor.name, error);
81
+ }
82
+ });
83
+ }
84
+ };
85
+ exports.MvtClusterService = MvtClusterService = __decorate([
86
+ (0, tsyringe_1.injectable)(),
87
+ __param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.PostgresConnector)),
88
+ __param(1, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
89
+ __metadata("design:paramtypes", [Object, Object])
90
+ ], MvtClusterService);
91
+ //# sourceMappingURL=MvtClusterService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MvtClusterService.js","sourceRoot":"","sources":["../../../src/output-gateway/services/MvtClusterService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAwE;AACxE,0DAAqH;AACrH,wEAAqE;AAErE,mEAAiE;AACjE,6EAAwE;AAIjE,IAAM,iBAAiB,+BAAvB,MAAM,iBAAiB;IAC1B,YACyC,SAAqC,EAChD,MAAuB;QADJ,cAAS,GAAT,SAAS,CAAoB;QACxC,WAAM,GAAN,MAAM,CAAS;QA8C7C,wBAAmB,GAAiB,CAAC,EACzC,CAAC,EACD,CAAC,EACD,CAAC,EACD,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,KAAK,GACS,EAAE,EAAE,CAAC;;YAEf,QAAQ;;;YAGR,YAAY,GAAG,CAAC,oBAAoB,UAAU;eAC3C,KAAK;;qCAEiB,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,QAAQ;cACxD,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;KAC7D,CAAC;QAEM,wBAAmB,GAAiB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAc,EAAE,EAAE,CAAC;;yBAErG,QAAQ,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,MAAM,KAAK,UAAU;;;4CAGjD,UAAU;;eAEvC,KAAK;KACf,CAAC;IA1EC,CAAC;IAES,OAAO,CAChB,KAAa,EACb,QAAgB,EAChB,CAAS,EACT,CAAS,EACT,CAAS,EACT,SAAiB,EACjB,UAAoB,EACpB,MAAM,GAAG,EAAE;;YAEX,MAAM,aAAa,GAAG;gBAClB,WAAW,EAAE,QAAQ;gBACrB,MAAM,EAAE,IAAI;gBACZ,UAAU,EAAE,GAAG;gBACf,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,EAAE;gBACT,YAAY,EAAE,IAAI,CAAC,mBAAmB;gBACtC,YAAY,EAAE,IAAI,CAAC,mBAAmB;aACzC,CAAC;YAEF,MAAM,KAAK,GAAG,IAAA,kCAAkB,kCACzB,aAAa,KAChB,CAAC;gBACD,CAAC;gBACD,CAAC,EACD,YAAY,EAAE,SAAS,EACvB,KAAK;gBACL,QAAQ;gBACR,MAAM;gBACN,UAAU,IACZ,CAAC;YAEH,IAAI;gBACA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC,KAAK,CAAsB,KAAK,EAAE;oBAClF,IAAI,EAAE,sBAAU,CAAC,MAAM;iBAC1B,CAAC,CAAC;gBACH,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;aACxB;YAAC,OAAO,KAAK,EAAE;gBACZ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,6BAA6B,KAAK,EAAE,CAAC,CAAC;gBAC/D,MAAM,IAAI,6BAAY,CAAC,0BAA0B,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;aACpF;QACL,CAAC;KAAA;CAgCJ,CAAA;4BA/EY,iBAAiB;IAD7B,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,iBAAiB,CAAC,CAAA;IACnC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;;GAHpB,iBAAiB,CA+E7B"}
@@ -0,0 +1,33 @@
1
+ # Implementační dokumentace modulu _mvt-maps_
2
+
3
+ ## Záměr
4
+
5
+ Modul slouží k poskytování Mapbox Vector Tiles (MVT) z databázových tabulek. Umožňuje dynamicky generovat dlaždice (tiles)
6
+ pro mapové klienty na základě prostorových dat uložených v relační databázi.
7
+
8
+ Modul je součástí datové platformy a umožňuje vizualizaci různých prostorových entit (např. vozidla, parkoviště...)
9
+ prostřednictvím standardizovaného MVT formátu.
10
+
11
+ Hlavní funkcionality:
12
+
13
+ - Načítání prostorových dat z libovolné databázové tabulky.
14
+ - Dynamický výběr sloupců (attributes) a geometrie (geometry).
15
+ - Možnost filtrace dle zoom úrovně (maxZoom) a okolního rádiusu (radius).
16
+
17
+ ## Output API
18
+
19
+ ### Obecné
20
+
21
+ ### Obecné
22
+
23
+ - OpenAPI v3 dokumentace
24
+ - [OpenAPI](./openapi-output.yaml)
25
+ - Veřejné / neveřejné endpointy
26
+ - Endpoint `/v2/mvt/{z}/{x}/{y}` je neveřejný. Přístup řízen pomocí interního přístupového tokenu a omezen na interní služby.
27
+ - Postman kolekce
28
+ [Postman](./openapi-output.yaml)
29
+
30
+ #### _/v2/mvt/{z}/{x}/{y}_
31
+ - zdrojové tabulky
32
+ - Libovolná tabulka obsahující prostorová data ve formátu podporovaném PostGIS. Například: `vehiclesharing.vehicle_status`, `parkings.parkings`
33
+ - Obsah odpovědi je ve formátu application/x-protobuf (binární MVT).
package/docs/index.md ADDED
@@ -0,0 +1,3 @@
1
+ # @golemio/mvt-maps
2
+
3
+ This module is intended for use with Golemio services. Refer [here](https://gitlab.com/operator-ict/golemio/code/modules/core/-/blob/development/README.md) for further information on usage, local development and more.
@@ -0,0 +1,140 @@
1
+ openapi: 3.0.3
2
+
3
+ info:
4
+ title: 🗺️ MVT Maps
5
+ description: >-
6
+ <p>
7
+ This is a placeholder description that is automatically replaced in the build process, see <a href="https://gitlab.com/operator-ict/golemio/code/vp/output-gateway/-/blob/development/docs/openapi-header.yaml" target="_blank">/vp/output-gateway/docs/openapi-header.yaml</a>.
8
+ </p>
9
+ version: 1.0.0
10
+ contact:
11
+ name: Golemio Prague Data Platform
12
+ email: golemio@operatorict.cz
13
+ url: https://golemio.cz
14
+
15
+ servers:
16
+ - url: https://api.golemio.cz
17
+ description: Main (production) server
18
+ - url: https://rabin.golemio.cz
19
+ description: Test (development) server
20
+
21
+ tags:
22
+ - name: 🗺️ MVT Maps (v2)
23
+ description: General vector tile data from Golemio Data Platform
24
+
25
+ paths:
26
+ /v2/mvt/{z}/{x}/{y}:
27
+ get:
28
+ tags:
29
+ - 🗺️ MVT Maps (v2)
30
+ summary: Get vector tile data for a specific map tile
31
+ description: |
32
+ Returns a Mapbox Vector Tile (MVT) containing features from the specified table and geometry column.
33
+ Useful for rendering geospatial data on interactive maps at the specified zoom, x, and y tile coordinates.
34
+ parameters:
35
+ - name: z
36
+ in: path
37
+ description: Zoom level of the tile.
38
+ required: true
39
+ schema:
40
+ type: integer
41
+ example: 14
42
+ - name: x
43
+ in: path
44
+ description: X coordinate of the tile.
45
+ required: true
46
+ schema:
47
+ type: integer
48
+ example: 8849
49
+ - name: y
50
+ in: path
51
+ description: Y coordinate of the tile.
52
+ required: true
53
+ schema:
54
+ type: integer
55
+ example: 5550
56
+ - name: table
57
+ in: query
58
+ description: Fully qualified table name (e.g. `schema.table`) to fetch data from.
59
+ required: true
60
+ schema:
61
+ type: string
62
+ example: test.vehicle_status
63
+ - name: geometry
64
+ in: query
65
+ description: Name of the geometry column in the table.
66
+ required: true
67
+ schema:
68
+ type: string
69
+ example: point
70
+ - name: attributes
71
+ in: query
72
+ description: List of attribute columns to include in the tile features.
73
+ required: true
74
+ schema:
75
+ type: array
76
+ items:
77
+ type: string
78
+ example: [ "id", "system_id", "description" ]
79
+ - name: maxZoom
80
+ in: query
81
+ description: Maximum zoom level at which data from this table should be rendered.
82
+ required: false
83
+ schema:
84
+ type: number
85
+ example: 12
86
+ - name: radius
87
+ in: query
88
+ description: Buffer radius in pixels around the tile to include features near edges.
89
+ required: false
90
+ schema:
91
+ type: number
92
+ example: 15
93
+ responses:
94
+ 200:
95
+ description: OK
96
+ headers:
97
+ Cache-Control:
98
+ description: Cache control directive for caching proxies.
99
+ schema:
100
+ type: string
101
+ example: public, s-maxage=300, stale-while-revalidate=5
102
+ Content-Type:
103
+ description: The MIME type of the response.
104
+ schema:
105
+ type: string
106
+ example: application/vnd.mapbox-vector-tile
107
+ content:
108
+ application/vnd.mapbox-vector-tile:
109
+ schema:
110
+ type: string
111
+ format: binary
112
+ 401:
113
+ $ref: "#/components/responses/UnauthorizedError"
114
+
115
+ components:
116
+ headers:
117
+ LastModified:
118
+ description: Timestamp of the latest resource update.
119
+ schema:
120
+ type: string
121
+ format: date-time
122
+ example: "2025-05-01T12:00:00.000Z"
123
+ CacheControlNoCache:
124
+ description: Cache control directive for no-cache policies.
125
+ schema:
126
+ type: string
127
+ example: no-store, no-cache, must-revalidate
128
+
129
+ responses:
130
+ UnauthorizedError:
131
+ description: Access token is missing or invalid.
132
+ content:
133
+ application/json:
134
+ schema:
135
+ type: object
136
+ properties:
137
+ message:
138
+ type: string
139
+ example: Unauthorized
140
+
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@golemio/mvt-maps",
3
+ "version": "0.0.1-dev.1826529834",
4
+ "description": "Golemio MVT Maps Module",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "rimraf ./dist && tspc -p ./tsconfig.build.json",
9
+ "build-minimal": "run-s 'build -- --sourceMap false --declaration false'",
10
+ "build-watch": "run-s 'build -- --watch --preserveWatchOutput'",
11
+ "pretest": "golemio import-db-data --postgres",
12
+ "test": "cross-env NODE_ENV=test mocha --exit --check-leaks --timeout 120000 -r ts-node/register -r tsconfig-paths/register -r dotenv/config 'test/**/*.test.ts' --reporter-option maxDiffSize=0 --file 'test/setup.ts'",
13
+ "test-debug": "run-s 'test -- --inspect-brk=9230'",
14
+ "code-coverage": "nyc run-s 'test -- -r source-map-support/register'",
15
+ "apidocs-test": "npm run apidocs-test-output",
16
+ "apidocs-test-output": "cross-env NODE_ENV=test golemio swagger api-test --oas docs/openapi-output.yaml --script test/api-docs/output-gateway/server.js --config test/api-docs/output-gateway/portman-config.json",
17
+ "generate-docs": "typedoc --out docs/typedoc src",
18
+ "lint": "eslint --cache \"{src,test}/**/*.ts\""
19
+ },
20
+ "keywords": [
21
+ "golemio"
22
+ ],
23
+ "author": "Operator ICT, a.s.",
24
+ "license": "MIT",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://gitlab.com/operator-ict/golemio/code/modules/mvt-maps"
28
+ },
29
+ "engines": {
30
+ "node": ">=20.0.0",
31
+ "npm": ">=8.0.0"
32
+ },
33
+ "devDependencies": {
34
+ "@apideck/portman": "^1.26.5",
35
+ "@commitlint/cli": "^19.3.0",
36
+ "@commitlint/config-conventional": "^11.0.0",
37
+ "@golemio/cli": "1.6.1",
38
+ "@golemio/core": "1.13.4-dev.1428623255",
39
+ "@golemio/db-common": "1.1.6-dev.1825018482",
40
+ "@golemio/eslint-config": "1.1.2",
41
+ "@types/chai": "4.2.3",
42
+ "@types/chai-as-promised": "7.1.2",
43
+ "@types/mocha": "^9.1.1",
44
+ "@types/node": "^20.12.7",
45
+ "@types/sinon": "^9.0.10",
46
+ "@types/supertest": "^2.0.10",
47
+ "body-parser": "^1.19.0",
48
+ "body-parser-xml": "^2.0.0",
49
+ "chai": "4.2.0",
50
+ "chai-as-promised": "7.1.1",
51
+ "cross-env": "^7.0.3",
52
+ "dotenv": "^8.2.0",
53
+ "eslint": "^8.1.1",
54
+ "husky": "^4.3.7",
55
+ "mocha": "^10.0.0",
56
+ "npm-run-all": "^4.1.5",
57
+ "nyc": "^15.1.0",
58
+ "prettier": "^2.5.1",
59
+ "pretty-quick": "^3.1.0",
60
+ "rimraf": "^3.0.2",
61
+ "sinon": "^9.2.3",
62
+ "source-map-support": "0.5.21",
63
+ "supertest": "^6.0.1",
64
+ "ts-node": "^10.9.1",
65
+ "ts-patch": "3.0.0-beta3",
66
+ "tsconfig-paths": "^4.2.0",
67
+ "typedoc": "^0.24.8",
68
+ "typescript": "5.1.3",
69
+ "typescript-transform-paths": "^3.4.6"
70
+ },
71
+ "dependencies": {
72
+ "@golemio/clusterbuster": "0.0.0-development-diversion.1-dev.1825112551"
73
+ },
74
+ "peerDependencies": {
75
+ "@golemio/core": ">=1.20.5"
76
+ }
77
+ }