moleculer-postgis
Advanced tools
Comparing version 0.2.7 to 0.3.0
{ | ||
"name": "moleculer-postgis", | ||
"version": "0.2.7", | ||
"version": "0.3.0", | ||
"description": "Postgis mixin and functions for @moleculer/database", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -72,3 +72,7 @@ # Save, validate and parse geometries on your `@moleculer/database` project | ||
PostgisMixin({ | ||
srid: 3346, | ||
srid: 3346, // default 3346 | ||
geojson: { // optional - Documentation: https://postgis.net/docs/ST_AsGeoJSON.html | ||
maxDecimalDigits: 0 // default | ||
options: 0 // default | ||
} | ||
}), | ||
@@ -75,0 +79,0 @@ ], |
@@ -7,2 +7,6 @@ import { Context } from 'moleculer'; | ||
srid: number; | ||
geojson: { | ||
maxDecimalDigits: number; | ||
options: number; | ||
}; | ||
}): { | ||
@@ -9,0 +13,0 @@ hooks: { |
@@ -64,3 +64,6 @@ "use strict"; | ||
function PostgisMixin(opts) { | ||
opts = (0, lodash_1.merge)(opts || {}, { srid: 3346 }); | ||
opts = (0, lodash_1.merge)(opts || {}, { | ||
srid: 3346, | ||
geojson: { maxDecimalDigits: 0, options: 0 }, | ||
}); | ||
function _getPropertiesFromFeatureCollection(geom, property) { | ||
@@ -137,2 +140,3 @@ if (!geom) | ||
function _getFeatureCollectionFromGeom(ctx) { | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -145,4 +149,4 @@ const adapter = yield this.getAdapter(ctx); | ||
const query = table.select('id', table.client.raw((0, queries_1.asGeoJsonQuery)(field, 'geom', opts.srid, { | ||
digits: 0, | ||
options: 0, | ||
digits: ((_a = opts === null || opts === void 0 ? void 0 : opts.geojson) === null || _a === void 0 ? void 0 : _a.maxDecimalDigits) || 0, | ||
options: ((_b = opts === null || opts === void 0 ? void 0 : opts.geojson) === null || _b === void 0 ? void 0 : _b.options) || 0, | ||
}))); | ||
@@ -149,0 +153,0 @@ if (Array.isArray(properties)) { |
Sorry, the diff of this file is not supported yet
53771
550
250