@opengis/gis 0.2.115 → 0.2.116
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/package.json
CHANGED
|
@@ -12,10 +12,10 @@ const dirname = path.dirname(filepath);
|
|
|
12
12
|
const PROTO_PATH = path.join(dirname, '../', 'map.proto');
|
|
13
13
|
// const PROTO_PATH = config.mapServerAddress && config.mapServerAddress.startsWith('127.0.0.1') ? path.join(dirname, '../../../../../../service/mapnikp/map.proto') : path.join(dirname, '../', 'map.proto');
|
|
14
14
|
|
|
15
|
-
const {
|
|
15
|
+
const { mapnik } = config;
|
|
16
16
|
|
|
17
|
-
if (!
|
|
18
|
-
throw new Error("
|
|
17
|
+
if (!mapnik?.server) {
|
|
18
|
+
throw new Error("Mapnik server address is not defined in the configuration.");
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const proto = grpc.loadPackageDefinition(
|
|
@@ -32,7 +32,7 @@ const proto = grpc.loadPackageDefinition(
|
|
|
32
32
|
);
|
|
33
33
|
|
|
34
34
|
const mapClient = new proto.map.MapService(
|
|
35
|
-
|
|
35
|
+
mapnik.server,
|
|
36
36
|
grpc.credentials.createInsecure(),
|
|
37
37
|
);
|
|
38
38
|
|
|
@@ -140,7 +140,7 @@ const grpcMethods = Object.getOwnPropertyNames(
|
|
|
140
140
|
|
|
141
141
|
const getMapnik = () => ({
|
|
142
142
|
...grpcMethods,
|
|
143
|
-
mapServerAddress,
|
|
143
|
+
mapServerAddress: mapnik?.server,
|
|
144
144
|
});
|
|
145
145
|
|
|
146
146
|
export default getMapnik;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
1
2
|
import { createHash } from 'node:crypto';
|
|
2
3
|
|
|
3
|
-
import
|
|
4
|
+
import SphericalMercator from '@mapbox/sphericalmercator';
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
7
|
config, logger, pgClients,
|
|
@@ -10,7 +11,7 @@ import mapnik from '../../../plugins/mapnik/funcs/mapnik.js';
|
|
|
10
11
|
|
|
11
12
|
const { RenderTile } = mapnik();
|
|
12
13
|
|
|
13
|
-
const mercator = new
|
|
14
|
+
const mercator = new SphericalMercator({ size: 256 });
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Формування растрового tile cartoCss
|
|
@@ -27,7 +28,7 @@ const mercator = new Sphericalmercator({ size: 256 });
|
|
|
27
28
|
* @param {String} y - координата x
|
|
28
29
|
*/
|
|
29
30
|
|
|
30
|
-
export default async function
|
|
31
|
+
export default async function gisRtile({
|
|
31
32
|
pg = pgClients.client, params, query, user,
|
|
32
33
|
}, reply) {
|
|
33
34
|
if (!RenderTile) {
|
|
@@ -93,14 +94,15 @@ export default async function rtile({
|
|
|
93
94
|
: undefined;
|
|
94
95
|
|
|
95
96
|
const param = {
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
// skipSubdir: true,
|
|
98
|
+
path: data.type === 'css' ? null : path.posix.join(config.mapnik?.folder || '', 'raster', data.source_path), // for rasters only
|
|
99
|
+
name: data.type === 'css' && data.source_path ? path.posix.join('raster', config.mapnik?.folder || '', 'vector', data.source_path) : id, // required for cartocss
|
|
98
100
|
width: 256,
|
|
99
101
|
bbox,
|
|
100
102
|
ttl,
|
|
101
103
|
debug: query.debug,
|
|
102
104
|
};
|
|
103
|
-
|
|
105
|
+
|
|
104
106
|
const result = await RenderTile(param);
|
|
105
107
|
|
|
106
108
|
if (query.debug) {
|