@osmix/shapefile 0.0.4 → 0.0.7

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/utils.js CHANGED
@@ -57,8 +57,10 @@ async function streamToArrayBuffer(stream) {
57
57
  const { done, value } = await reader.read();
58
58
  if (done)
59
59
  break;
60
- chunks.push(value);
61
- totalLength += value.byteLength;
60
+ if (value !== undefined) {
61
+ chunks.push(value);
62
+ totalLength += value.byteLength;
63
+ }
62
64
  }
63
65
  const result = new Uint8Array(totalLength);
64
66
  let offset = 0;
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC;;;GAGG;AAGH,OAAO,GAAG,MAAM,OAAO,CAAA;AAGvB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CACnC,IAA4B;IAE5B,IAAI,IAAI,IAAI,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAA;IAEjD,IAAI,KAA+B,CAAA;IAEnC,wCAAwC;IACxC,IAAI,IAAI,YAAY,cAAc,EAAE,CAAC;QACpC,KAAK,GAAG,MAAM,mBAAmB,CAAC,IAAI,CAAC,CAAA;IACxC,CAAC;SAAM,IAAI,IAAI,YAAY,iBAAiB,EAAE,CAAC;QAC9C,mDAAmD;QACnD,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAC7C,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;QAC9C,KAAK,GAAG,IAAI,CAAA;IACb,CAAC;SAAM,CAAC;QACP,KAAK,GAAG,IAAI,CAAA;IACb,CAAC;IAED,MAAM,MAAM,GAAgB,MAAM,GAAG,CAAC,KAAK,CAAC,CAAA;IAE5C,qBA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AAK,IAAI,MAAM,EAAE,CAAC;QAC5B,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QACzB,MAAM,IAAI,KAAK,CAAC,UAAU,CAAA;IAC3B,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAA;AACrB,CAAC"}
package/package.json CHANGED
@@ -2,26 +2,11 @@
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@osmix/shapefile",
4
4
  "description": "Import Shapefiles into Osmix indexes.",
5
- "version": "0.0.4",
5
+ "version": "0.0.7",
6
6
  "type": "module",
7
- "main": "./src/index.ts",
8
- "types": "./src/index.ts",
7
+ "types": "./dist/index.d.ts",
9
8
  "publishConfig": {
10
- "access": "public",
11
- "registry": "https://registry.npmjs.org/",
12
- "main": "./dist/index.js",
13
- "types": "./dist/index.d.ts",
14
- "exports": {
15
- ".": {
16
- "import": "./dist/index.js",
17
- "types": "./dist/index.d.ts"
18
- }
19
- },
20
- "files": [
21
- "dist",
22
- "README.md",
23
- "LICENSE"
24
- ]
9
+ "access": "public"
25
10
  },
26
11
  "license": "MIT",
27
12
  "repository": {
@@ -42,14 +27,28 @@
42
27
  "typecheck": "tsgo --noEmit"
43
28
  },
44
29
  "devDependencies": {
45
- "@types/bun": "^1.3.3",
46
- "@types/geojson": "^7946.0.16",
47
- "typescript": "^5.9.0"
30
+ "@types/bun": "catalog:",
31
+ "@types/geojson": "catalog:",
32
+ "typescript": "catalog:"
48
33
  },
49
34
  "dependencies": {
50
- "@osmix/core": "0.1.3",
51
- "@osmix/shared": "0.0.8",
52
- "@placemarkio/geojson-rewind": "^1.0.3",
35
+ "@osmix/core": "workspace:*",
36
+ "@osmix/shared": "workspace:*",
37
+ "@placemarkio/geojson-rewind": "catalog:",
53
38
  "shpjs": "^6.2.0"
54
- }
39
+ },
40
+ "exports": {
41
+ ".": {
42
+ "types": "./src/index.ts",
43
+ "bun": "./src/index.ts",
44
+ "development|production": "./src/index.ts",
45
+ "default": "./dist/index.js"
46
+ }
47
+ },
48
+ "files": [
49
+ "dist",
50
+ "src",
51
+ "README.md",
52
+ "LICENSE"
53
+ ]
55
54
  }
package/src/utils.ts CHANGED
@@ -67,8 +67,10 @@ async function streamToArrayBuffer(
67
67
  while (true) {
68
68
  const { done, value } = await reader.read()
69
69
  if (done) break
70
- chunks.push(value)
71
- totalLength += value.byteLength
70
+ if (value !== undefined) {
71
+ chunks.push(value)
72
+ totalLength += value.byteLength
73
+ }
72
74
  }
73
75
 
74
76
  const result = new Uint8Array(totalLength)
package/CHANGELOG.md DELETED
@@ -1,32 +0,0 @@
1
- # @osmix/shapefile
2
-
3
- ## 0.0.4
4
-
5
- ### Patch Changes
6
-
7
- - f468db5: Fix publishing (2)
8
- - Updated dependencies [f468db5]
9
- - @osmix/core@0.1.3
10
- - @osmix/shared@0.0.8
11
-
12
- ## 0.0.3
13
-
14
- ### Patch Changes
15
-
16
- - 68d6bd8: Fix publishing for packages.
17
- - Updated dependencies [68d6bd8]
18
- - @osmix/core@0.1.2
19
- - @osmix/shared@0.0.7
20
-
21
- ## 0.0.2
22
-
23
- ### Patch Changes
24
-
25
- - Updated dependencies [d4f4b1f]
26
- - @osmix/core@0.1.1
27
-
28
- ## 0.0.1
29
-
30
- ### Patch Changes
31
-
32
- - Initial release: Import Shapefiles into Osmix indexes.
@@ -1,33 +0,0 @@
1
- /**
2
- * @osmix/shapefile - Import Shapefiles into Osmix indexes.
3
- *
4
- * Provides Shapefile import functionality for Osmix using shpjs:
5
- * - **Import**: Build an Osm index from Shapefile data (ZIP archive or URL).
6
- *
7
- * Shapefiles are first parsed to GeoJSON by shpjs (with automatic projection
8
- * to WGS84), then converted to OSM entities:
9
- * - Point/MultiPoint → Node(s)
10
- * - LineString/MultiLineString → Way(s)
11
- * - Polygon → Way or Relation (based on ring count)
12
- * - MultiPolygon → Relation
13
- *
14
- * @example
15
- * ```ts
16
- * // Import Shapefile to Osm index
17
- * import { fromShapefile } from "@osmix/shapefile"
18
- *
19
- * const zipBuffer = await Bun.file('./buildings.zip').arrayBuffer()
20
- * const osm = await fromShapefile(zipBuffer, { id: "buildings" })
21
- *
22
- * // Or from URL
23
- * const osm = await fromShapefile('https://example.com/data.zip')
24
- *
25
- * // Query the imported data
26
- * const buildings = osm.ways.search("building")
27
- * ```
28
- *
29
- * @module @osmix/shapefile
30
- */
31
- export * from "./osm-from-shapefile";
32
- export * from "./types";
33
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,cAAc,sBAAsB,CAAA;AACpC,cAAc,SAAS,CAAA"}
package/dist/src/index.js DELETED
@@ -1,33 +0,0 @@
1
- /**
2
- * @osmix/shapefile - Import Shapefiles into Osmix indexes.
3
- *
4
- * Provides Shapefile import functionality for Osmix using shpjs:
5
- * - **Import**: Build an Osm index from Shapefile data (ZIP archive or URL).
6
- *
7
- * Shapefiles are first parsed to GeoJSON by shpjs (with automatic projection
8
- * to WGS84), then converted to OSM entities:
9
- * - Point/MultiPoint → Node(s)
10
- * - LineString/MultiLineString → Way(s)
11
- * - Polygon → Way or Relation (based on ring count)
12
- * - MultiPolygon → Relation
13
- *
14
- * @example
15
- * ```ts
16
- * // Import Shapefile to Osm index
17
- * import { fromShapefile } from "@osmix/shapefile"
18
- *
19
- * const zipBuffer = await Bun.file('./buildings.zip').arrayBuffer()
20
- * const osm = await fromShapefile(zipBuffer, { id: "buildings" })
21
- *
22
- * // Or from URL
23
- * const osm = await fromShapefile('https://example.com/data.zip')
24
- *
25
- * // Query the imported data
26
- * const buildings = osm.ways.search("building")
27
- * ```
28
- *
29
- * @module @osmix/shapefile
30
- */
31
- export * from "./osm-from-shapefile";
32
- export * from "./types";
33
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,cAAc,sBAAsB,CAAA;AACpC,cAAc,SAAS,CAAA"}
@@ -1,67 +0,0 @@
1
- /**
2
- * Shapefile-to-OSM conversion utilities.
3
- *
4
- * Imports Shapefiles into Osm indexes by first parsing them to GeoJSON
5
- * using shpjs, then converting the GeoJSON to OSM entities.
6
- *
7
- * @module
8
- */
9
- import { Osm, type OsmOptions } from "@osmix/core";
10
- import { type ProgressEvent } from "@osmix/shared/progress";
11
- import type { FeatureCollection } from "geojson";
12
- import type { ReadShapefileDataTypes } from "./types";
13
- /**
14
- * Create an Osm index from Shapefile data.
15
- *
16
- * Parses Shapefiles using shpjs (which returns GeoJSON) and converts
17
- * the features to OSM entities:
18
- * - Point → Node
19
- * - LineString/MultiLineString → Way(s) with nodes
20
- * - Polygon → Way (simple) or Relation (with holes)
21
- * - MultiPolygon → Relation
22
- *
23
- * Feature properties become OSM tags.
24
- *
25
- * @param data - Shapefile data (URL string or ArrayBuffer of ZIP).
26
- * @param options - Osm index options (id, header).
27
- * @param onProgress - Progress callback for UI feedback.
28
- * @returns Populated Osm index with built indexes.
29
- *
30
- * @example
31
- * ```ts
32
- * import { fromShapefile } from "@osmix/shapefile"
33
- *
34
- * // From file
35
- * const zipBuffer = await Bun.file('./buildings.zip').arrayBuffer()
36
- * const osm = await fromShapefile(zipBuffer, { id: "buildings" })
37
- *
38
- * // From URL
39
- * const osm = await fromShapefile('https://example.com/data.zip')
40
- *
41
- * // Query the imported data
42
- * const buildings = osm.ways.search("building")
43
- * ```
44
- */
45
- export declare function fromShapefile(data: ReadShapefileDataTypes, options?: Partial<OsmOptions>, onProgress?: (progress: ProgressEvent) => void): Promise<Osm>;
46
- /**
47
- * Generator that converts GeoJSON features from a shapefile to OSM entities.
48
- *
49
- * This is the core conversion logic, yielding progress events as features
50
- * are processed.
51
- *
52
- * Geometry mapping:
53
- * - **Point**: Creates a single node with feature properties as tags.
54
- * - **MultiPoint**: Creates multiple nodes.
55
- * - **LineString**: Creates nodes for each coordinate, then a way referencing them.
56
- * - **MultiLineString**: Creates multiple ways.
57
- * - **Polygon**: Creates a way for simple polygons; for polygons with holes,
58
- * creates separate ways for outer and inner rings plus a multipolygon relation.
59
- * - **MultiPolygon**: Creates a multipolygon relation with all rings as way members.
60
- *
61
- * @param osm - Target Osm index to populate.
62
- * @param geojson - Parsed GeoJSON FeatureCollection from shapefile.
63
- * @param name - Name for progress reporting.
64
- * @yields Progress events during conversion.
65
- */
66
- export declare function startCreateOsmFromShapefile(osm: Osm, geojson: FeatureCollection, name: string): Generator<ProgressEvent>;
67
- //# sourceMappingURL=osm-from-shapefile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"osm-from-shapefile.d.ts","sourceRoot":"","sources":["../../src/osm-from-shapefile.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,GAAG,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAEN,KAAK,aAAa,EAElB,MAAM,wBAAwB,CAAA;AAG/B,OAAO,KAAK,EAEX,iBAAiB,EAKjB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,aAAa,CAClC,IAAI,EAAE,sBAAsB,EAC5B,OAAO,GAAE,OAAO,CAAC,UAAU,CAAM,EACjC,UAAU,GAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAkB,GACzD,OAAO,CAAC,GAAG,CAAC,CAmBd;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAiB,2BAA2B,CAC3C,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE,MAAM,GACV,SAAS,CAAC,aAAa,CAAC,CAiK1B"}
@@ -1,335 +0,0 @@
1
- /**
2
- * Shapefile-to-OSM conversion utilities.
3
- *
4
- * Imports Shapefiles into Osm indexes by first parsing them to GeoJSON
5
- * using shpjs, then converting the GeoJSON to OSM entities.
6
- *
7
- * @module
8
- */
9
- import { Osm } from "@osmix/core";
10
- import { logProgress, progressEvent, } from "@osmix/shared/progress";
11
- import { rewindFeature } from "@placemarkio/geojson-rewind";
12
- import { parseShapefile } from "./utils";
13
- /**
14
- * Create an Osm index from Shapefile data.
15
- *
16
- * Parses Shapefiles using shpjs (which returns GeoJSON) and converts
17
- * the features to OSM entities:
18
- * - Point → Node
19
- * - LineString/MultiLineString → Way(s) with nodes
20
- * - Polygon → Way (simple) or Relation (with holes)
21
- * - MultiPolygon → Relation
22
- *
23
- * Feature properties become OSM tags.
24
- *
25
- * @param data - Shapefile data (URL string or ArrayBuffer of ZIP).
26
- * @param options - Osm index options (id, header).
27
- * @param onProgress - Progress callback for UI feedback.
28
- * @returns Populated Osm index with built indexes.
29
- *
30
- * @example
31
- * ```ts
32
- * import { fromShapefile } from "@osmix/shapefile"
33
- *
34
- * // From file
35
- * const zipBuffer = await Bun.file('./buildings.zip').arrayBuffer()
36
- * const osm = await fromShapefile(zipBuffer, { id: "buildings" })
37
- *
38
- * // From URL
39
- * const osm = await fromShapefile('https://example.com/data.zip')
40
- *
41
- * // Query the imported data
42
- * const buildings = osm.ways.search("building")
43
- * ```
44
- */
45
- export async function fromShapefile(data, options = {}, onProgress = logProgress) {
46
- const osm = new Osm(options);
47
- onProgress(progressEvent("Parsing Shapefile..."));
48
- const collections = await parseShapefile(data);
49
- for (const collection of collections) {
50
- const name = collection.fileName ?? "shapefile";
51
- for (const update of startCreateOsmFromShapefile(osm, collection, name)) {
52
- onProgress(update);
53
- }
54
- }
55
- // Build indexes after all collections are processed
56
- onProgress(progressEvent("Building indexes..."));
57
- osm.buildIndexes();
58
- osm.buildSpatialIndexes();
59
- return osm;
60
- }
61
- /**
62
- * Generator that converts GeoJSON features from a shapefile to OSM entities.
63
- *
64
- * This is the core conversion logic, yielding progress events as features
65
- * are processed.
66
- *
67
- * Geometry mapping:
68
- * - **Point**: Creates a single node with feature properties as tags.
69
- * - **MultiPoint**: Creates multiple nodes.
70
- * - **LineString**: Creates nodes for each coordinate, then a way referencing them.
71
- * - **MultiLineString**: Creates multiple ways.
72
- * - **Polygon**: Creates a way for simple polygons; for polygons with holes,
73
- * creates separate ways for outer and inner rings plus a multipolygon relation.
74
- * - **MultiPolygon**: Creates a multipolygon relation with all rings as way members.
75
- *
76
- * @param osm - Target Osm index to populate.
77
- * @param geojson - Parsed GeoJSON FeatureCollection from shapefile.
78
- * @param name - Name for progress reporting.
79
- * @yields Progress events during conversion.
80
- */
81
- export function* startCreateOsmFromShapefile(osm, geojson, name) {
82
- yield progressEvent(`Converting "${name}" to Osmix...`);
83
- // Map to track nodes by coordinate string for reuse when creating ways and relations
84
- const nodeMap = new Map();
85
- let nextNodeId = osm.nodes.size > 0 ? -osm.nodes.size - 1 : -1;
86
- let nextWayId = osm.ways.size > 0 ? -osm.ways.size - 1 : -1;
87
- let nextRelationId = osm.relations.size > 0 ? -osm.relations.size - 1 : -1;
88
- // Helper to get or create a node for a coordinate
89
- const getOrCreateNode = (lon, lat) => {
90
- const coordKey = `${lon},${lat}`;
91
- const existingNodeId = nodeMap.get(coordKey);
92
- if (existingNodeId !== undefined) {
93
- return existingNodeId;
94
- }
95
- const nodeId = nextNodeId--;
96
- nodeMap.set(coordKey, nodeId);
97
- osm.nodes.addNode({
98
- id: nodeId,
99
- lon,
100
- lat,
101
- });
102
- return nodeId;
103
- };
104
- // Process each feature
105
- let count = 0;
106
- for (const feature of geojson.features) {
107
- const geometry = feature.geometry;
108
- if (!geometry)
109
- continue;
110
- // Normalize winding order for polygons
111
- const normalizedFeature = geometry.type === "Polygon" || geometry.type === "MultiPolygon"
112
- ? rewindFeature(feature)
113
- : feature;
114
- const tags = propertiesToTags(normalizedFeature.properties);
115
- const featureId = extractFeatureId(normalizedFeature.id);
116
- const geomType = normalizedFeature.geometry?.type;
117
- if (geomType === "Point") {
118
- const coords = normalizedFeature.geometry.coordinates;
119
- const [lon, lat] = coords;
120
- if (lon === undefined || lat === undefined)
121
- continue;
122
- const nodeId = featureId ?? nextNodeId--;
123
- osm.nodes.addNode({
124
- id: nodeId,
125
- lon,
126
- lat,
127
- tags,
128
- });
129
- nodeMap.set(`${lon},${lat}`, nodeId);
130
- }
131
- else if (geomType === "MultiPoint") {
132
- const coords = normalizedFeature.geometry
133
- .coordinates;
134
- for (const [lon, lat] of coords) {
135
- if (lon === undefined || lat === undefined)
136
- continue;
137
- const nodeId = nextNodeId--;
138
- osm.nodes.addNode({
139
- id: nodeId,
140
- lon,
141
- lat,
142
- tags,
143
- });
144
- nodeMap.set(`${lon},${lat}`, nodeId);
145
- }
146
- }
147
- else if (geomType === "LineString") {
148
- const coords = normalizedFeature.geometry.coordinates;
149
- if (coords.length < 2)
150
- continue;
151
- const nodeRefs = [];
152
- for (const [lon, lat] of coords) {
153
- if (lon === undefined || lat === undefined)
154
- continue;
155
- const nodeId = getOrCreateNode(lon, lat);
156
- nodeRefs.push(nodeId);
157
- }
158
- if (nodeRefs.length >= 2) {
159
- const wayId = featureId ?? nextWayId--;
160
- osm.ways.addWay({
161
- id: wayId,
162
- refs: nodeRefs,
163
- tags,
164
- });
165
- }
166
- }
167
- else if (geomType === "MultiLineString") {
168
- const coords = normalizedFeature.geometry
169
- .coordinates;
170
- for (const line of coords) {
171
- if (line.length < 2)
172
- continue;
173
- const nodeRefs = [];
174
- for (const [lon, lat] of line) {
175
- if (lon === undefined || lat === undefined)
176
- continue;
177
- const nodeId = getOrCreateNode(lon, lat);
178
- nodeRefs.push(nodeId);
179
- }
180
- if (nodeRefs.length >= 2) {
181
- const wayId = nextWayId--;
182
- osm.ways.addWay({
183
- id: wayId,
184
- refs: nodeRefs,
185
- tags,
186
- });
187
- }
188
- }
189
- }
190
- else if (geomType === "Polygon") {
191
- const coords = normalizedFeature.geometry.coordinates;
192
- processPolygonRings(osm, coords, tags, featureId, () => nextWayId--, () => nextRelationId--, getOrCreateNode);
193
- }
194
- else if (geomType === "MultiPolygon") {
195
- const coords = normalizedFeature.geometry.coordinates;
196
- const relationMembers = [];
197
- for (const polygon of coords) {
198
- const { outerWayId, holeWayIds } = processPolygonRings(osm, polygon, undefined, // Tags go on relation
199
- undefined, () => nextWayId--, () => nextRelationId--, getOrCreateNode);
200
- if (outerWayId !== undefined) {
201
- relationMembers.push({ type: "way", ref: outerWayId, role: "outer" });
202
- for (const holeId of holeWayIds) {
203
- relationMembers.push({ type: "way", ref: holeId, role: "inner" });
204
- }
205
- }
206
- }
207
- if (relationMembers.length > 0) {
208
- osm.relations.addRelation({
209
- id: featureId ?? nextRelationId--,
210
- members: relationMembers,
211
- tags: { type: "multipolygon", ...tags },
212
- });
213
- }
214
- }
215
- if (++count % 1000 === 0) {
216
- yield progressEvent(`Processed ${count} features from "${name}"...`);
217
- }
218
- }
219
- yield progressEvent(`Finished converting "${name}" to Osmix...`);
220
- }
221
- /**
222
- * Process polygon rings and add to OSM index.
223
- * Returns the created way IDs for use in multipolygon relations.
224
- */
225
- function processPolygonRings(osm, coordinates, tags, featureId, getNextWayId, getNextRelationId, getOrCreateNode) {
226
- if (coordinates.length === 0) {
227
- return { outerWayId: undefined, holeWayIds: [] };
228
- }
229
- const outerRing = coordinates[0];
230
- if (!outerRing || outerRing.length < 3) {
231
- return { outerWayId: undefined, holeWayIds: [] };
232
- }
233
- const createRelation = coordinates.length > 1;
234
- // Create nodes for outer ring
235
- const outerNodeRefs = [];
236
- for (const coord of outerRing) {
237
- const [lon, lat] = coord;
238
- if (lon === undefined || lat === undefined)
239
- continue;
240
- const nodeId = getOrCreateNode(lon, lat);
241
- outerNodeRefs.push(nodeId);
242
- }
243
- if (outerNodeRefs.length < 3) {
244
- return { outerWayId: undefined, holeWayIds: [] };
245
- }
246
- // Ensure ring is closed
247
- if (outerNodeRefs[0] !== outerNodeRefs[outerNodeRefs.length - 1]) {
248
- outerNodeRefs.push(outerNodeRefs[0]);
249
- }
250
- // Create way for outer ring
251
- const outerWayId = createRelation
252
- ? getNextWayId()
253
- : (featureId ?? getNextWayId());
254
- osm.ways.addWay({
255
- id: outerWayId,
256
- refs: outerNodeRefs,
257
- tags: createRelation ? { area: "yes" } : { area: "yes", ...tags },
258
- });
259
- // Create separate ways for holes
260
- const holeWayIds = [];
261
- for (let i = 1; i < coordinates.length; i++) {
262
- const holeRing = coordinates[i];
263
- if (!holeRing || holeRing.length < 3)
264
- continue;
265
- const holeNodeRefs = [];
266
- for (const coord of holeRing) {
267
- const [lon, lat] = coord;
268
- if (lon === undefined || lat === undefined)
269
- continue;
270
- const nodeId = getOrCreateNode(lon, lat);
271
- holeNodeRefs.push(nodeId);
272
- }
273
- if (holeNodeRefs.length < 3)
274
- continue;
275
- // Ensure hole ring is closed
276
- if (holeNodeRefs[0] !== holeNodeRefs[holeNodeRefs.length - 1]) {
277
- holeNodeRefs.push(holeNodeRefs[0]);
278
- }
279
- const holeWayId = getNextWayId();
280
- osm.ways.addWay({
281
- id: holeWayId,
282
- refs: holeNodeRefs,
283
- tags: { area: "yes" },
284
- });
285
- holeWayIds.push(holeWayId);
286
- }
287
- if (createRelation) {
288
- osm.relations.addRelation({
289
- id: featureId ?? getNextRelationId(),
290
- members: [
291
- { type: "way", ref: outerWayId, role: "outer" },
292
- ...holeWayIds.map((id) => ({ type: "way", ref: id, role: "inner" })),
293
- ],
294
- tags: {
295
- type: "multipolygon",
296
- ...tags,
297
- },
298
- });
299
- }
300
- return { outerWayId, holeWayIds };
301
- }
302
- /**
303
- * Convert GeoJSON properties to OSM tags.
304
- */
305
- function propertiesToTags(properties) {
306
- if (!properties || Object.keys(properties).length === 0) {
307
- return undefined;
308
- }
309
- const tags = {};
310
- for (const [key, value] of Object.entries(properties)) {
311
- if (typeof value === "string" || typeof value === "number") {
312
- tags[key] = value;
313
- }
314
- else if (value != null) {
315
- tags[key] = String(value);
316
- }
317
- }
318
- return Object.keys(tags).length > 0 ? tags : undefined;
319
- }
320
- /**
321
- * Extract numeric ID from feature.
322
- */
323
- function extractFeatureId(featureId) {
324
- if (featureId === undefined)
325
- return undefined;
326
- if (typeof featureId === "number")
327
- return featureId;
328
- if (typeof featureId === "string") {
329
- const numId = Number.parseInt(featureId, 10);
330
- if (!Number.isNaN(numId))
331
- return numId;
332
- }
333
- return undefined;
334
- }
335
- //# sourceMappingURL=osm-from-shapefile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"osm-from-shapefile.js","sourceRoot":"","sources":["../../src/osm-from-shapefile.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,GAAG,EAAmB,MAAM,aAAa,CAAA;AAClD,OAAO,EACN,WAAW,EAEX,aAAa,GACb,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAU3D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAClC,IAA4B,EAC5B,UAA+B,EAAE,EACjC,aAAgD,WAAW;IAE3D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAA;IAE5B,UAAU,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAAA;IACjD,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAA;IAE9C,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,IAAI,WAAW,CAAA;QAC/C,KAAK,MAAM,MAAM,IAAI,2BAA2B,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC;YACzE,UAAU,CAAC,MAAM,CAAC,CAAA;QACnB,CAAC;IACF,CAAC;IAED,oDAAoD;IACpD,UAAU,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC,C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IAAI,EAAE,CAAC;YAC1B,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;QAC1B,CAAC;IACF,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;AACvD,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CACxB,SAAsC;IAEtC,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IAC7C,IAAI,OAAO,SAAS,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAA;IACnD,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;QAC5C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAA;IACvC,CAAC;IACD,OAAO,SAAS,CAAA;AACjB,CAAC"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Type definitions for Shapefile import.
3
- * @module
4
- */
5
- import type { FeatureCollection } from "geojson";
6
- /**
7
- * Input types accepted by `fromShapefile`.
8
- *
9
- * Supports multiple formats:
10
- * - `ArrayBufferLike` - Binary ZIP data containing shapefile components
11
- * - `ReadableStream` - Stream of ZIP data (will be consumed to ArrayBuffer)
12
- * - `string` - URL to a shapefile or ZIP file
13
- */
14
- export type ReadShapefileDataTypes = ArrayBufferLike | ReadableStream | string;
15
- /**
16
- * Result from shpjs parsing.
17
- * Can be a single FeatureCollection or an array if the ZIP contains multiple shapefiles.
18
- */
19
- export type ShpjsResult = (FeatureCollection & {
20
- fileName?: string;
21
- }) | (FeatureCollection & {
22
- fileName?: string;
23
- })[];
24
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG,cAAc,GAAG,MAAM,CAAA;AAE9E;;;GAGG;AACH,MAAM,MAAM,WAAW,GACpB,CAAC,iBAAiB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAC3C,CAAC,iBAAiB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,CAAA"}
package/dist/src/types.js DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * Type definitions for Shapefile import.
3
- * @module
4
- */
5
- //# sourceMappingURL=types.js.map