@map-colonies/mc-utils 3.5.5 → 3.5.6
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/files/shapefile/core/gdalShapefileReader.d.ts +65 -0
- package/dist/files/shapefile/core/gdalShapefileReader.d.ts.map +1 -0
- package/dist/files/shapefile/core/gdalShapefileReader.js +112 -0
- package/dist/files/shapefile/core/gdalShapefileReader.js.map +1 -0
- package/dist/files/shapefile/core/shapeFileReader.d.ts.map +1 -1
- package/dist/files/shapefile/core/shapeFileReader.js +11 -5
- package/dist/files/shapefile/core/shapeFileReader.js.map +1 -1
- package/dist/files/shapefile/index.d.ts +1 -0
- package/dist/files/shapefile/index.d.ts.map +1 -1
- package/dist/files/shapefile/index.js +4 -1
- package/dist/files/shapefile/index.js.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Feature } from 'geojson';
|
|
2
|
+
/**
|
|
3
|
+
* Result of reading a feature from the shapefile
|
|
4
|
+
* Matches the interface pattern used by the shapefile package
|
|
5
|
+
*/
|
|
6
|
+
export interface ShapefileReadResult {
|
|
7
|
+
done: boolean;
|
|
8
|
+
value: Feature;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Interface for shapefile reader that can be used interchangeably
|
|
12
|
+
* with either gdal-async or the shapefile package
|
|
13
|
+
*/
|
|
14
|
+
export interface IShapefileSource {
|
|
15
|
+
read: () => Promise<ShapefileReadResult>;
|
|
16
|
+
close: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Adapter class that wraps gdal-async to provide a shapefile reader
|
|
20
|
+
* compatible with the interface expected by ShapefileChunkReader.
|
|
21
|
+
*
|
|
22
|
+
* This adapter allows seamless migration from the 'shapefile' npm package
|
|
23
|
+
* to 'gdal-async' while maintaining the same API contract.
|
|
24
|
+
*/
|
|
25
|
+
export declare class GdalShapefileReader implements IShapefileSource {
|
|
26
|
+
private readonly dataset;
|
|
27
|
+
private readonly layer;
|
|
28
|
+
private isFirstRead;
|
|
29
|
+
private constructor();
|
|
30
|
+
/**
|
|
31
|
+
* Opens a shapefile using gdal-async and returns a reader instance.
|
|
32
|
+
* This is the async factory method to create a GdalShapefileReader.
|
|
33
|
+
*
|
|
34
|
+
* @param shapefilePath - Path to the .shp file
|
|
35
|
+
* @returns Promise resolving to a GdalShapefileReader instance
|
|
36
|
+
*/
|
|
37
|
+
static open(shapefilePath: string): Promise<GdalShapefileReader>;
|
|
38
|
+
/**
|
|
39
|
+
* Reads the next feature from the shapefile.
|
|
40
|
+
* Returns { done: true, value: undefined } when no more features are available.
|
|
41
|
+
*
|
|
42
|
+
* @returns Promise resolving to the read result with done flag and feature value
|
|
43
|
+
*/
|
|
44
|
+
readonly read: () => Promise<ShapefileReadResult>;
|
|
45
|
+
/**
|
|
46
|
+
* Closes the underlying dataset and releases resources.
|
|
47
|
+
* Should be called when done reading the shapefile.
|
|
48
|
+
*/
|
|
49
|
+
close(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Converts a GDAL feature to a GeoJSON Feature object.
|
|
52
|
+
*
|
|
53
|
+
* @param gdalFeature - The GDAL feature to convert
|
|
54
|
+
* @returns GeoJSON Feature object
|
|
55
|
+
*/
|
|
56
|
+
private convertToGeoJsonFeature;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Factory function to open a shapefile using gdal-async.
|
|
60
|
+
*
|
|
61
|
+
* @param shapefilePath - Path to the .shp file
|
|
62
|
+
* @returns Promise resolving to a shapefile reader
|
|
63
|
+
*/
|
|
64
|
+
export declare function openShapefile(shapefilePath: string): Promise<IShapefileSource>;
|
|
65
|
+
//# sourceMappingURL=gdalShapefileReader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gdalShapefileReader.d.ts","sourceRoot":"","sources":["../../../../src/files/shapefile/core/gdalShapefileReader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAA+B,MAAM,SAAS,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACzC,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;;;GAMG;AACH,qBAAa,mBAAoB,YAAW,gBAAgB;IAItC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAH5C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,WAAW,CAAQ;IAE3B,OAAO;IAIP;;;;;;OAMG;WACiB,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO7E;;;;;OAKG;IAEH,SAAgB,IAAI,QAAO,QAAQ,mBAAmB,CAAC,CAyBrD;IAEF;;;OAGG;IACI,KAAK,IAAI,IAAI;IAIpB;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;CAyBhC;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAEpF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.openShapefile = exports.GdalShapefileReader = void 0;
|
|
7
|
+
const gdal_async_1 = __importDefault(require("gdal-async"));
|
|
8
|
+
/**
|
|
9
|
+
* Adapter class that wraps gdal-async to provide a shapefile reader
|
|
10
|
+
* compatible with the interface expected by ShapefileChunkReader.
|
|
11
|
+
*
|
|
12
|
+
* This adapter allows seamless migration from the 'shapefile' npm package
|
|
13
|
+
* to 'gdal-async' while maintaining the same API contract.
|
|
14
|
+
*/
|
|
15
|
+
class GdalShapefileReader {
|
|
16
|
+
dataset;
|
|
17
|
+
layer;
|
|
18
|
+
isFirstRead = true;
|
|
19
|
+
constructor(dataset) {
|
|
20
|
+
this.dataset = dataset;
|
|
21
|
+
this.layer = dataset.layers.get(0);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Opens a shapefile using gdal-async and returns a reader instance.
|
|
25
|
+
* This is the async factory method to create a GdalShapefileReader.
|
|
26
|
+
*
|
|
27
|
+
* @param shapefilePath - Path to the .shp file
|
|
28
|
+
* @returns Promise resolving to a GdalShapefileReader instance
|
|
29
|
+
*/
|
|
30
|
+
static async open(shapefilePath) {
|
|
31
|
+
// Note: GDAL handles .dbf file association automatically based on the .shp path
|
|
32
|
+
// and typically reads encoding from .cpg file if present, or uses UTF-8 by default
|
|
33
|
+
const dataset = await gdal_async_1.default.openAsync(shapefilePath);
|
|
34
|
+
return new GdalShapefileReader(dataset);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Reads the next feature from the shapefile.
|
|
38
|
+
* Returns { done: true, value: undefined } when no more features are available.
|
|
39
|
+
*
|
|
40
|
+
* @returns Promise resolving to the read result with done flag and feature value
|
|
41
|
+
*/
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
43
|
+
read = () => {
|
|
44
|
+
// Note: GDAL types say Feature is always returned, but in practice it returns null when done
|
|
45
|
+
let gdalFeature;
|
|
46
|
+
if (this.isFirstRead) {
|
|
47
|
+
this.isFirstRead = false;
|
|
48
|
+
gdalFeature = this.layer.features.first();
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
gdalFeature = this.layer.features.next();
|
|
52
|
+
}
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, @typescript-eslint/strict-boolean-expressions
|
|
54
|
+
if (!gdalFeature) {
|
|
55
|
+
return Promise.resolve({
|
|
56
|
+
done: true,
|
|
57
|
+
value: undefined,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const feature = this.convertToGeoJsonFeature(gdalFeature);
|
|
61
|
+
return Promise.resolve({
|
|
62
|
+
done: false,
|
|
63
|
+
value: feature,
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Closes the underlying dataset and releases resources.
|
|
68
|
+
* Should be called when done reading the shapefile.
|
|
69
|
+
*/
|
|
70
|
+
close() {
|
|
71
|
+
this.dataset.close();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Converts a GDAL feature to a GeoJSON Feature object.
|
|
75
|
+
*
|
|
76
|
+
* @param gdalFeature - The GDAL feature to convert
|
|
77
|
+
* @returns GeoJSON Feature object
|
|
78
|
+
*/
|
|
79
|
+
convertToGeoJsonFeature(gdalFeature) {
|
|
80
|
+
const geometry = gdalFeature.getGeometry();
|
|
81
|
+
const properties = gdalFeature.fields.toObject();
|
|
82
|
+
// Convert GDAL geometry to GeoJSON
|
|
83
|
+
let geoJsonGeometry = null;
|
|
84
|
+
if (geometry) {
|
|
85
|
+
geoJsonGeometry = geometry.toObject();
|
|
86
|
+
}
|
|
87
|
+
const feature = {
|
|
88
|
+
type: 'Feature',
|
|
89
|
+
geometry: geoJsonGeometry,
|
|
90
|
+
properties,
|
|
91
|
+
};
|
|
92
|
+
// Preserve feature ID if present
|
|
93
|
+
const fid = gdalFeature.fid;
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
95
|
+
if (fid !== undefined) {
|
|
96
|
+
feature.id = fid;
|
|
97
|
+
}
|
|
98
|
+
return feature;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.GdalShapefileReader = GdalShapefileReader;
|
|
102
|
+
/**
|
|
103
|
+
* Factory function to open a shapefile using gdal-async.
|
|
104
|
+
*
|
|
105
|
+
* @param shapefilePath - Path to the .shp file
|
|
106
|
+
* @returns Promise resolving to a shapefile reader
|
|
107
|
+
*/
|
|
108
|
+
async function openShapefile(shapefilePath) {
|
|
109
|
+
return GdalShapefileReader.open(shapefilePath);
|
|
110
|
+
}
|
|
111
|
+
exports.openShapefile = openShapefile;
|
|
112
|
+
//# sourceMappingURL=gdalShapefileReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gdalShapefileReader.js","sourceRoot":"","sources":["../../../../src/files/shapefile/core/gdalShapefileReader.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA8B;AAqB9B;;;;;;GAMG;AACH,MAAa,mBAAmB;IAIO;IAHpB,KAAK,CAAa;IAC3B,WAAW,GAAG,IAAI,CAAC;IAE3B,YAAqC,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;QACxD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,aAAqB;QAC5C,gFAAgF;QAChF,mFAAmF;QACnF,MAAM,OAAO,GAAG,MAAM,oBAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACpD,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;OAKG;IACH,qEAAqE;IACrD,IAAI,GAAG,GAAiC,EAAE;QACxD,6FAA6F;QAC7F,IAAI,WAAgC,CAAC;QAErC,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;YACzB,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;SAC3C;aAAM;YACL,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;SAC1C;QAED,sHAAsH;QACtH,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,OAAO,CAAC,OAAO,CAAC;gBACrB,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,SAA+B;aACvC,CAAC,CAAC;SACJ;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;QAE1D,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,OAAO;SACf,CAAC,CAAC;IACL,CAAC,CAAC;IAEF;;;OAGG;IACI,KAAK;QACV,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACK,uBAAuB,CAAC,WAAyB;QACvD,MAAM,QAAQ,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;QAC3C,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAuB,CAAC;QAEtE,mCAAmC;QACnC,IAAI,eAAe,GAAoB,IAAI,CAAC;QAC5C,IAAI,QAAQ,EAAE;YACZ,eAAe,GAAG,QAAQ,CAAC,QAAQ,EAAc,CAAC;SACnD;QAED,MAAM,OAAO,GAAY;YACvB,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,eAA2B;YACrC,UAAU;SACX,CAAC;QAEF,iCAAiC;QACjC,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC;QAC5B,uEAAuE;QACvE,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,OAAO,CAAC,EAAE,GAAG,GAAG,CAAC;SAClB;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA/FD,kDA+FC;AAED;;;;;GAKG;AACI,KAAK,UAAU,aAAa,CAAC,aAAqB;IACvD,OAAO,mBAAmB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACjD,CAAC;AAFD,sCAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shapeFileReader.d.ts","sourceRoot":"","sources":["../../../../src/files/shapefile/core/shapeFileReader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shapeFileReader.d.ts","sourceRoot":"","sources":["../../../../src/files/shapefile/core/shapeFileReader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiB,cAAc,EAAmB,YAAY,EAAE,aAAa,EAAkB,MAAM,UAAU,CAAC;AAMvH,qBAAa,oBAAoB;IAKZ,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ3C,OAAO,CAAC,cAAc,CAAC,CAAkB;IACzC,OAAO,CAAC,eAAe,CAAC,CAAmB;IAC3C,OAAO,CAAC,SAAS,CAAgC;gBAEb,OAAO,EAAE,aAAa;IAE1D;;;;OAIG;IACU,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA0F5F;;;;OAIG;IACU,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,GAAG,eAAe,CAAC,CAAC;YA0CvG,YAAY;IA+B1B;;;OAGG;YACW,mBAAmB;YAenB,iBAAiB;IAuB/B,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,mBAAmB;CAG5B"}
|
|
@@ -4,10 +4,10 @@ exports.ShapefileChunkReader = void 0;
|
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
6
6
|
const node_crypto_1 = require("node:crypto");
|
|
7
|
-
const shapefile_1 = require("shapefile");
|
|
8
7
|
const vertices_1 = require("../../../geo/vertices");
|
|
9
8
|
const types_1 = require("../types");
|
|
10
9
|
const chunkBuilder_1 = require("./chunkBuilder");
|
|
10
|
+
const gdalShapefileReader_1 = require("./gdalShapefileReader");
|
|
11
11
|
const metricsManager_1 = require("./metricsManager");
|
|
12
12
|
const progressTracker_1 = require("./progressTracker");
|
|
13
13
|
class ShapefileChunkReader {
|
|
@@ -27,10 +27,9 @@ class ShapefileChunkReader {
|
|
|
27
27
|
const chunkIndex = await this.initializeReading(shapefilePath);
|
|
28
28
|
let readFeatureIndex = -1;
|
|
29
29
|
const chunkBuilder = new chunkBuilder_1.ChunkBuilder(this.options.maxVerticesPerChunk, chunkIndex);
|
|
30
|
+
let reader;
|
|
30
31
|
try {
|
|
31
|
-
|
|
32
|
-
//support feature properties with hebrew characters by setting encoding to 'utf-8'
|
|
33
|
-
const reader = await (0, shapefile_1.open)(shapefilePath, dbfPath, { encoding: 'utf-8' });
|
|
32
|
+
reader = await (0, gdalShapefileReader_1.openShapefile)(shapefilePath);
|
|
34
33
|
this.options.logger?.info({ msg: 'Reading started' });
|
|
35
34
|
const generateFeatureId = this.options.generateFeatureId ?? false;
|
|
36
35
|
let readStart = performance.now();
|
|
@@ -95,6 +94,9 @@ class ShapefileChunkReader {
|
|
|
95
94
|
});
|
|
96
95
|
throw error;
|
|
97
96
|
}
|
|
97
|
+
finally {
|
|
98
|
+
reader?.close();
|
|
99
|
+
}
|
|
98
100
|
}
|
|
99
101
|
/**
|
|
100
102
|
* Count total features and vertices in the shapefile for progress calculation
|
|
@@ -102,10 +104,11 @@ class ShapefileChunkReader {
|
|
|
102
104
|
* @returns Total number of features and vertices in the shapefile
|
|
103
105
|
*/
|
|
104
106
|
async getShapefileStats(shapefilePath) {
|
|
105
|
-
|
|
107
|
+
let reader;
|
|
106
108
|
let totalVertices = 0;
|
|
107
109
|
let totalFeatures = 0;
|
|
108
110
|
try {
|
|
111
|
+
reader = await (0, gdalShapefileReader_1.openShapefile)(shapefilePath);
|
|
109
112
|
// eslint-disable-next-line no-constant-condition
|
|
110
113
|
while (true) {
|
|
111
114
|
const { done, value: feature } = await reader.read();
|
|
@@ -127,6 +130,9 @@ class ShapefileChunkReader {
|
|
|
127
130
|
this.options.logger?.error({ msg: 'Error counting vertices in shapefile', shapefilePath, error });
|
|
128
131
|
throw error;
|
|
129
132
|
}
|
|
133
|
+
finally {
|
|
134
|
+
reader?.close();
|
|
135
|
+
}
|
|
130
136
|
if (totalFeatures === 0 || totalVertices === 0) {
|
|
131
137
|
const message = `Shapefile ${shapefilePath} has no valid features or vertices`;
|
|
132
138
|
this.options.logger?.error({ msg: message });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shapeFileReader.js","sourceRoot":"","sources":["../../../../src/files/shapefile/core/shapeFileReader.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,gEAAgE;AAChE,6CAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"shapeFileReader.js","sourceRoot":"","sources":["../../../../src/files/shapefile/core/shapeFileReader.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,gEAAgE;AAChE,6CAAyC;AACzC,oDAAsD;AACtD,oCAAuH;AACvH,iDAA8C;AAC9C,+DAAwE;AACxE,qDAAmE;AACnE,uDAAsE;AAEtE,MAAa,oBAAoB;IAKK;IAJ5B,cAAc,CAAmB;IACjC,eAAe,CAAoB;IACnC,SAAS,GAA2B,IAAI,CAAC;IAEjD,YAAoC,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;IAAG,CAAC;IAE9D;;;;OAIG;IACI,KAAK,CAAC,cAAc,CAAC,aAAqB,EAAE,SAAyB;QAC1E,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;QAC/D,IAAI,gBAAgB,GAAG,CAAC,CAAC,CAAC;QAE1B,MAAM,YAAY,GAAG,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;QACpF,IAAI,MAAoC,CAAC;QACzC,IAAI;YACF,MAAM,GAAG,MAAM,IAAA,mCAAa,EAAC,aAAa,CAAC,CAAC;YAC5C,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,iBAAiB,EAAE,CAAC,CAAC;YAEtD,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,IAAI,KAAK,CAAC;YA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wB,CAAC;AAC9D,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/files/shapefile/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACvH,cAAc,SAAS,CAAC"}
|
|
@@ -14,8 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ShapefileChunkReader = void 0;
|
|
17
|
+
exports.GdalShapefileReader = exports.openShapefile = exports.ShapefileChunkReader = void 0;
|
|
18
18
|
var shapeFileReader_1 = require("./core/shapeFileReader");
|
|
19
19
|
Object.defineProperty(exports, "ShapefileChunkReader", { enumerable: true, get: function () { return shapeFileReader_1.ShapefileChunkReader; } });
|
|
20
|
+
var gdalShapefileReader_1 = require("./core/gdalShapefileReader");
|
|
21
|
+
Object.defineProperty(exports, "openShapefile", { enumerable: true, get: function () { return gdalShapefileReader_1.openShapefile; } });
|
|
22
|
+
Object.defineProperty(exports, "GdalShapefileReader", { enumerable: true, get: function () { return gdalShapefileReader_1.GdalShapefileReader; } });
|
|
20
23
|
__exportStar(require("./types"), exports);
|
|
21
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/files/shapefile/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0DAA8D;AAArD,uHAAA,oBAAoB,OAAA;AAC7B,0CAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/files/shapefile/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0DAA8D;AAArD,uHAAA,oBAAoB,OAAA;AAC7B,kEAAuH;AAA9G,oHAAA,aAAa,OAAA;AAAE,0HAAA,mBAAmB,OAAA;AAC3C,0CAAwB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@map-colonies/mc-utils",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.6",
|
|
4
4
|
"description": "This is template for map colonies typescript packages",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
"@types/lodash": "^4.14.171",
|
|
51
51
|
"@types/ngeohash": "^0.6.3",
|
|
52
52
|
"@types/node": "^14.14.12",
|
|
53
|
-
"@types/shapefile": "^0.6.4",
|
|
54
53
|
"commitlint": "^17.4.4",
|
|
55
54
|
"cz-conventional-changelog": "^3.3.0",
|
|
56
55
|
"eslint": "^8.36.0",
|
|
@@ -70,16 +69,19 @@
|
|
|
70
69
|
"@turf/turf": "^6.5.0",
|
|
71
70
|
"axios": "^1.3.6",
|
|
72
71
|
"axios-retry": "^3.4.0",
|
|
72
|
+
"gdal-async": "^3.12.1",
|
|
73
73
|
"http-status-codes": "^2.2.0",
|
|
74
74
|
"lodash": "^4.17.21",
|
|
75
75
|
"ngeohash": "^0.6.3",
|
|
76
|
-
"shapefile": "^0.6.6",
|
|
77
76
|
"zod": "^3.24.1"
|
|
78
77
|
},
|
|
79
78
|
"peerDependencies": {
|
|
80
79
|
"@map-colonies/error-types": "^1.3.1",
|
|
81
80
|
"@map-colonies/js-logger": "^1.0.1"
|
|
82
81
|
},
|
|
82
|
+
"engines": {
|
|
83
|
+
"node": ">=20"
|
|
84
|
+
},
|
|
83
85
|
"//OverrideComment": "https://github.com/Turfjs/turf/issues/2922",
|
|
84
86
|
"overrides": {
|
|
85
87
|
"concaveman": "1.2.1"
|