@osmix/shapefile 0.0.3 → 0.0.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/CHANGELOG.md +26 -0
- package/dist/utils.js +4 -2
- package/dist/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/utils.ts +4 -2
- package/dist/src/index.d.ts +0 -33
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -33
- package/dist/src/index.js.map +0 -1
- package/dist/src/osm-from-shapefile.d.ts +0 -67
- package/dist/src/osm-from-shapefile.d.ts.map +0 -1
- package/dist/src/osm-from-shapefile.js +0 -335
- package/dist/src/osm-from-shapefile.js.map +0 -1
- package/dist/src/types.d.ts +0 -24
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -5
- package/dist/src/types.js.map +0 -1
- package/dist/src/utils.d.ts +0 -28
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/src/utils.js +0 -71
- package/dist/src/utils.js.map +0 -1
- package/dist/test/osm-from-shapefile.test.d.ts +0 -2
- package/dist/test/osm-from-shapefile.test.d.ts.map +0 -1
- package/dist/test/osm-from-shapefile.test.js +0 -460
- package/dist/test/osm-from-shapefile.test.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @osmix/shapefile
|
|
2
2
|
|
|
3
|
+
## 0.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [12728ed]
|
|
8
|
+
- @osmix/shared@0.0.10
|
|
9
|
+
- @osmix/core@0.1.5
|
|
10
|
+
|
|
11
|
+
## 0.0.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- f32e4ee: General cleanup
|
|
16
|
+
- Updated dependencies [f32e4ee]
|
|
17
|
+
- @osmix/core@0.1.4
|
|
18
|
+
- @osmix/shared@0.0.9
|
|
19
|
+
|
|
20
|
+
## 0.0.4
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- f468db5: Fix publishing (2)
|
|
25
|
+
- Updated dependencies [f468db5]
|
|
26
|
+
- @osmix/core@0.1.3
|
|
27
|
+
- @osmix/shared@0.0.8
|
|
28
|
+
|
|
3
29
|
## 0.0.3
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
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
|
-
|
|
61
|
-
|
|
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,C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C;IAED,OAAO,MAAM,CAAC,MAAM,CAAA;AACrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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.
|
|
5
|
+
"version": "0.0.6",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./src/index.ts",
|
|
8
8
|
"types": "./src/index.ts",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"typescript": "^5.9.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@osmix/core": "0.1.
|
|
51
|
-
"@osmix/shared": "0.0.
|
|
50
|
+
"@osmix/core": "0.1.5",
|
|
51
|
+
"@osmix/shared": "0.0.10",
|
|
52
52
|
"@placemarkio/geojson-rewind": "^1.0.3",
|
|
53
53
|
"shpjs": "^6.2.0"
|
|
54
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
|
-
|
|
71
|
-
|
|
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/dist/src/index.d.ts
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.d.ts.map
|
package/dist/src/index.d.ts.map
DELETED
|
@@ -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
|
package/dist/src/index.js.map
DELETED
|
@@ -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,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@
|
|
|
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
|
package/dist/src/types.d.ts.map
DELETED
|
@@ -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
package/dist/src/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
package/dist/src/utils.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions for Shapefile data handling.
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
import type { FeatureCollection } from "geojson";
|
|
6
|
-
import type { ReadShapefileDataTypes } from "./types";
|
|
7
|
-
/**
|
|
8
|
-
* Parse Shapefile data and return GeoJSON FeatureCollection(s).
|
|
9
|
-
*
|
|
10
|
-
* Uses shpjs to parse Shapefiles and automatically project to WGS84.
|
|
11
|
-
*
|
|
12
|
-
* @param data - Shapefile data (URL string, ArrayBuffer/ReadableStream of ZIP).
|
|
13
|
-
* @returns Array of GeoJSON FeatureCollections with optional fileName.
|
|
14
|
-
* @throws If data is null or parsing fails.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* // From ArrayBuffer
|
|
19
|
-
* const collections = await parseShapefile(zipBuffer)
|
|
20
|
-
*
|
|
21
|
-
* // From URL
|
|
22
|
-
* const collections = await parseShapefile('https://example.com/data.zip')
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare function parseShapefile(data: ReadShapefileDataTypes): Promise<(FeatureCollection & {
|
|
26
|
-
fileName?: string;
|
|
27
|
-
})[]>;
|
|
28
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/src/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AACA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD,OAAO,KAAK,EAAE,sBAAsB,EAAe,MAAM,SAAS,CAAA;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,cAAc,CACnC,IAAI,EAAE,sBAAsB,GAC1B,OAAO,CAAC,CAAC,iBAAiB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,CAAC,CAwBxD"}
|
package/dist/src/utils.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/// <reference path="./shpjs.d.ts" />
|
|
2
|
-
/**
|
|
3
|
-
* Utility functions for Shapefile data handling.
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
import shp from "shpjs";
|
|
7
|
-
/**
|
|
8
|
-
* Parse Shapefile data and return GeoJSON FeatureCollection(s).
|
|
9
|
-
*
|
|
10
|
-
* Uses shpjs to parse Shapefiles and automatically project to WGS84.
|
|
11
|
-
*
|
|
12
|
-
* @param data - Shapefile data (URL string, ArrayBuffer/ReadableStream of ZIP).
|
|
13
|
-
* @returns Array of GeoJSON FeatureCollections with optional fileName.
|
|
14
|
-
* @throws If data is null or parsing fails.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* // From ArrayBuffer
|
|
19
|
-
* const collections = await parseShapefile(zipBuffer)
|
|
20
|
-
*
|
|
21
|
-
* // From URL
|
|
22
|
-
* const collections = await parseShapefile('https://example.com/data.zip')
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export async function parseShapefile(data) {
|
|
26
|
-
if (data == null)
|
|
27
|
-
throw new Error("Data is null");
|
|
28
|
-
let input;
|
|
29
|
-
// Convert ReadableStream to ArrayBuffer
|
|
30
|
-
if (data instanceof ReadableStream) {
|
|
31
|
-
input = await streamToArrayBuffer(data);
|
|
32
|
-
}
|
|
33
|
-
else if (data instanceof SharedArrayBuffer) {
|
|
34
|
-
// shpjs expects ArrayBuffer, not SharedArrayBuffer
|
|
35
|
-
const copy = new ArrayBuffer(data.byteLength);
|
|
36
|
-
new Uint8Array(copy).set(new Uint8Array(data));
|
|
37
|
-
input = copy;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
input = data;
|
|
41
|
-
}
|
|
42
|
-
const result = await shp(input);
|
|
43
|
-
// Normalize to array
|
|
44
|
-
if (Array.isArray(result)) {
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
return [result];
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Convert a ReadableStream to an ArrayBuffer.
|
|
51
|
-
*/
|
|
52
|
-
async function streamToArrayBuffer(stream) {
|
|
53
|
-
const reader = stream.getReader();
|
|
54
|
-
const chunks = [];
|
|
55
|
-
let totalLength = 0;
|
|
56
|
-
while (true) {
|
|
57
|
-
const { done, value } = await reader.read();
|
|
58
|
-
if (done)
|
|
59
|
-
break;
|
|
60
|
-
chunks.push(value);
|
|
61
|
-
totalLength += value.byteLength;
|
|
62
|
-
}
|
|
63
|
-
const result = new Uint8Array(totalLength);
|
|
64
|
-
let offset = 0;
|
|
65
|
-
for (const chunk of chunks) {
|
|
66
|
-
result.set(chunk, offset);
|
|
67
|
-
offset += chunk.byteLength;
|
|
68
|
-
}
|
|
69
|
-
return result.buffer;
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/src/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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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AED,OAAO,MAAM,CAAC,MAAM,CAAA;AACrB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"osm-from-shapefile.test.d.ts","sourceRoot":"","sources":["../../test/osm-from-shapefile.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,460 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, mock } from "bun:test";
|
|
2
|
-
import { Osm } from "@osmix/core";
|
|
3
|
-
import { progressEventMessage } from "@osmix/shared/progress";
|
|
4
|
-
import { startCreateOsmFromShapefile } from "../src/osm-from-shapefile";
|
|
5
|
-
// Mock shpjs module
|
|
6
|
-
mock.module("shpjs", () => ({
|
|
7
|
-
default: async (input) => {
|
|
8
|
-
// Return the mock data passed through
|
|
9
|
-
return input;
|
|
10
|
-
},
|
|
11
|
-
}));
|
|
12
|
-
describe("@osmix/shapefile: startCreateOsmFromShapefile", () => {
|
|
13
|
-
it("should convert Point features to Nodes", () => {
|
|
14
|
-
const osm = new Osm();
|
|
15
|
-
const geojson = {
|
|
16
|
-
type: "FeatureCollection",
|
|
17
|
-
features: [
|
|
18
|
-
{
|
|
19
|
-
type: "Feature",
|
|
20
|
-
geometry: {
|
|
21
|
-
type: "Point",
|
|
22
|
-
coordinates: [-122.4194, 37.7749],
|
|
23
|
-
},
|
|
24
|
-
properties: {
|
|
25
|
-
name: "San Francisco",
|
|
26
|
-
population: 873965,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: "Feature",
|
|
31
|
-
geometry: {
|
|
32
|
-
type: "Point",
|
|
33
|
-
coordinates: [-122.4094, 37.7849],
|
|
34
|
-
},
|
|
35
|
-
properties: {
|
|
36
|
-
name: "Another Point",
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
};
|
|
41
|
-
for (const _ of startCreateOsmFromShapefile(osm, geojson, "test")) {
|
|
42
|
-
// Consume generator
|
|
43
|
-
}
|
|
44
|
-
osm.buildIndexes();
|
|
45
|
-
expect(osm.nodes.size).toBe(2);
|
|
46
|
-
expect(osm.ways.size).toBe(0);
|
|
47
|
-
const node1 = osm.nodes.getById(-1);
|
|
48
|
-
expect(node1).toBeDefined();
|
|
49
|
-
expect(node1?.lon).toBe(-122.4194);
|
|
50
|
-
expect(node1?.lat).toBe(37.7749);
|
|
51
|
-
expect(node1?.tags?.["name"]).toBe("San Francisco");
|
|
52
|
-
// OSM tags are stored as strings
|
|
53
|
-
expect(node1?.tags?.["population"]).toBe("873965");
|
|
54
|
-
const node2 = osm.nodes.getById(-2);
|
|
55
|
-
expect(node2).toBeDefined();
|
|
56
|
-
expect(node2?.lon).toBe(-122.4094);
|
|
57
|
-
expect(node2?.lat).toBe(37.7849);
|
|
58
|
-
expect(node2?.tags?.["name"]).toBe("Another Point");
|
|
59
|
-
});
|
|
60
|
-
it("should convert LineString features to Ways with Nodes", () => {
|
|
61
|
-
const osm = new Osm();
|
|
62
|
-
const geojson = {
|
|
63
|
-
type: "FeatureCollection",
|
|
64
|
-
features: [
|
|
65
|
-
{
|
|
66
|
-
type: "Feature",
|
|
67
|
-
geometry: {
|
|
68
|
-
type: "LineString",
|
|
69
|
-
coordinates: [
|
|
70
|
-
[-122.4194, 37.7749],
|
|
71
|
-
[-122.4094, 37.7849],
|
|
72
|
-
[-122.3994, 37.7949],
|
|
73
|
-
],
|
|
74
|
-
},
|
|
75
|
-
properties: {
|
|
76
|
-
highway: "primary",
|
|
77
|
-
name: "Main Street",
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
};
|
|
82
|
-
for (const _ of startCreateOsmFromShapefile(osm, geojson, "test")) {
|
|
83
|
-
// Consume generator
|
|
84
|
-
}
|
|
85
|
-
osm.buildIndexes();
|
|
86
|
-
expect(osm.nodes.size).toBe(3);
|
|
87
|
-
expect(osm.ways.size).toBe(1);
|
|
88
|
-
const way = osm.ways.getById(-1);
|
|
89
|
-
expect(way).toBeDefined();
|
|
90
|
-
expect(way?.refs).toHaveLength(3);
|
|
91
|
-
expect(way?.tags?.["highway"]).toBe("primary");
|
|
92
|
-
expect(way?.tags?.["name"]).toBe("Main Street");
|
|
93
|
-
// Verify nodes were created
|
|
94
|
-
const node1 = osm.nodes.getById(way.refs[0]);
|
|
95
|
-
const node2 = osm.nodes.getById(way.refs[1]);
|
|
96
|
-
const node3 = osm.nodes.getById(way.refs[2]);
|
|
97
|
-
expect(node1?.lon).toBe(-122.4194);
|
|
98
|
-
expect(node1?.lat).toBe(37.7749);
|
|
99
|
-
expect(node2?.lon).toBe(-122.4094);
|
|
100
|
-
expect(node2?.lat).toBe(37.7849);
|
|
101
|
-
expect(node3?.lon).toBe(-122.3994);
|
|
102
|
-
expect(node3?.lat).toBe(37.7949);
|
|
103
|
-
});
|
|
104
|
-
it("should convert simple Polygon features to Ways with area tags", () => {
|
|
105
|
-
const osm = new Osm();
|
|
106
|
-
const geojson = {
|
|
107
|
-
type: "FeatureCollection",
|
|
108
|
-
features: [
|
|
109
|
-
{
|
|
110
|
-
type: "Feature",
|
|
111
|
-
geometry: {
|
|
112
|
-
type: "Polygon",
|
|
113
|
-
coordinates: [
|
|
114
|
-
[
|
|
115
|
-
[-122.4194, 37.7749],
|
|
116
|
-
[-122.4094, 37.7749],
|
|
117
|
-
[-122.4094, 37.7849],
|
|
118
|
-
[-122.4194, 37.7849],
|
|
119
|
-
[-122.4194, 37.7749], // Closed ring
|
|
120
|
-
],
|
|
121
|
-
],
|
|
122
|
-
},
|
|
123
|
-
properties: {
|
|
124
|
-
building: "yes",
|
|
125
|
-
name: "Test Building",
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
};
|
|
130
|
-
for (const _ of startCreateOsmFromShapefile(osm, geojson, "test")) {
|
|
131
|
-
// Consume generator
|
|
132
|
-
}
|
|
133
|
-
osm.buildIndexes();
|
|
134
|
-
expect(osm.ways.size).toBe(1);
|
|
135
|
-
expect(osm.relations.size).toBe(0); // No relation for simple polygon
|
|
136
|
-
const way = osm.ways.getById(-1);
|
|
137
|
-
expect(way).toBeDefined();
|
|
138
|
-
expect(way?.tags?.["building"]).toBe("yes");
|
|
139
|
-
expect(way?.tags?.["name"]).toBe("Test Building");
|
|
140
|
-
expect(way?.tags?.["area"]).toBe("yes");
|
|
141
|
-
});
|
|
142
|
-
it("should convert Polygon with holes to relation with multiple Ways", () => {
|
|
143
|
-
const osm = new Osm();
|
|
144
|
-
const geojson = {
|
|
145
|
-
type: "FeatureCollection",
|
|
146
|
-
features: [
|
|
147
|
-
{
|
|
148
|
-
type: "Feature",
|
|
149
|
-
geometry: {
|
|
150
|
-
type: "Polygon",
|
|
151
|
-
coordinates: [
|
|
152
|
-
// Outer ring
|
|
153
|
-
[
|
|
154
|
-
[-122.4194, 37.7749],
|
|
155
|
-
[-122.4094, 37.7749],
|
|
156
|
-
[-122.4094, 37.7849],
|
|
157
|
-
[-122.4194, 37.7849],
|
|
158
|
-
[-122.4194, 37.7749],
|
|
159
|
-
],
|
|
160
|
-
// Hole
|
|
161
|
-
[
|
|
162
|
-
[-122.4164, 37.7779],
|
|
163
|
-
[-122.4144, 37.7779],
|
|
164
|
-
[-122.4144, 37.7799],
|
|
165
|
-
[-122.4164, 37.7799],
|
|
166
|
-
[-122.4164, 37.7779],
|
|
167
|
-
],
|
|
168
|
-
],
|
|
169
|
-
},
|
|
170
|
-
properties: {
|
|
171
|
-
building: "yes",
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
],
|
|
175
|
-
};
|
|
176
|
-
for (const _ of startCreateOsmFromShapefile(osm, geojson, "test")) {
|
|
177
|
-
// Consume generator
|
|
178
|
-
}
|
|
179
|
-
osm.buildIndexes();
|
|
180
|
-
// Should have outer ring way + hole way + relation
|
|
181
|
-
expect(osm.ways.size).toBe(2);
|
|
182
|
-
expect(osm.relations.size).toBe(1);
|
|
183
|
-
const relation = osm.relations.getById(-1);
|
|
184
|
-
expect(relation).toBeDefined();
|
|
185
|
-
expect(relation?.tags?.["type"]).toBe("multipolygon");
|
|
186
|
-
expect(relation?.tags?.["building"]).toBe("yes");
|
|
187
|
-
expect(relation?.members).toHaveLength(2);
|
|
188
|
-
expect(relation?.members[0]?.role).toBe("outer");
|
|
189
|
-
expect(relation?.members[1]?.role).toBe("inner");
|
|
190
|
-
});
|
|
191
|
-
it("should convert MultiPoint features to multiple Nodes", () => {
|
|
192
|
-
const osm = new Osm();
|
|
193
|
-
const geojson = {
|
|
194
|
-
type: "FeatureCollection",
|
|
195
|
-
features: [
|
|
196
|
-
{
|
|
197
|
-
type: "Feature",
|
|
198
|
-
geometry: {
|
|
199
|
-
type: "MultiPoint",
|
|
200
|
-
coordinates: [
|
|
201
|
-
[-122.4194, 37.7749],
|
|
202
|
-
[-122.4094, 37.7849],
|
|
203
|
-
[-122.3994, 37.7949],
|
|
204
|
-
],
|
|
205
|
-
},
|
|
206
|
-
properties: {
|
|
207
|
-
type: "stop",
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
],
|
|
211
|
-
};
|
|
212
|
-
for (const _ of startCreateOsmFromShapefile(osm, geojson, "test")) {
|
|
213
|
-
// Consume generator
|
|
214
|
-
}
|
|
215
|
-
osm.buildIndexes();
|
|
216
|
-
expect(osm.nodes.size).toBe(3);
|
|
217
|
-
expect(osm.ways.size).toBe(0);
|
|
218
|
-
// All three nodes should have the same tags
|
|
219
|
-
const node1 = osm.nodes.getById(-1);
|
|
220
|
-
const node2 = osm.nodes.getById(-2);
|
|
221
|
-
const node3 = osm.nodes.getById(-3);
|
|
222
|
-
expect(node1?.tags?.["type"]).toBe("stop");
|
|
223
|
-
expect(node2?.tags?.["type"]).toBe("stop");
|
|
224
|
-
expect(node3?.tags?.["type"]).toBe("stop");
|
|
225
|
-
});
|
|
226
|
-
it("should handle features without properties", () => {
|
|
227
|
-
const osm = new Osm();
|
|
228
|
-
const geojson = {
|
|
229
|
-
type: "FeatureCollection",
|
|
230
|
-
features: [
|
|
231
|
-
{
|
|
232
|
-
type: "Feature",
|
|
233
|
-
geometry: {
|
|
234
|
-
type: "Point",
|
|
235
|
-
coordinates: [-122.4194, 37.7749],
|
|
236
|
-
},
|
|
237
|
-
properties: null,
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
};
|
|
241
|
-
for (const _ of startCreateOsmFromShapefile(osm, geojson, "test")) {
|
|
242
|
-
// Consume generator
|
|
243
|
-
}
|
|
244
|
-
osm.buildIndexes();
|
|
245
|
-
expect(osm.nodes.size).toBe(1);
|
|
246
|
-
const node = osm.nodes.getById(-1);
|
|
247
|
-
expect(node).toBeDefined();
|
|
248
|
-
expect(node?.tags).toBeUndefined();
|
|
249
|
-
});
|
|
250
|
-
it("should reuse nodes when features share coordinates", () => {
|
|
251
|
-
const osm = new Osm();
|
|
252
|
-
const geojson = {
|
|
253
|
-
type: "FeatureCollection",
|
|
254
|
-
features: [
|
|
255
|
-
{
|
|
256
|
-
type: "Feature",
|
|
257
|
-
geometry: {
|
|
258
|
-
type: "LineString",
|
|
259
|
-
coordinates: [
|
|
260
|
-
[-122.4194, 37.7749],
|
|
261
|
-
[-122.4094, 37.7849],
|
|
262
|
-
],
|
|
263
|
-
},
|
|
264
|
-
properties: {
|
|
265
|
-
highway: "primary",
|
|
266
|
-
},
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
type: "Feature",
|
|
270
|
-
geometry: {
|
|
271
|
-
type: "LineString",
|
|
272
|
-
coordinates: [
|
|
273
|
-
[-122.4094, 37.7849], // Shared coordinate
|
|
274
|
-
[-122.3994, 37.7949],
|
|
275
|
-
],
|
|
276
|
-
},
|
|
277
|
-
properties: {
|
|
278
|
-
highway: "secondary",
|
|
279
|
-
},
|
|
280
|
-
},
|
|
281
|
-
],
|
|
282
|
-
};
|
|
283
|
-
for (const _ of startCreateOsmFromShapefile(osm, geojson, "test")) {
|
|
284
|
-
// Consume generator
|
|
285
|
-
}
|
|
286
|
-
osm.buildIndexes();
|
|
287
|
-
// Should have 3 nodes (shared coordinate is reused)
|
|
288
|
-
expect(osm.nodes.size).toBe(3);
|
|
289
|
-
expect(osm.ways.size).toBe(2);
|
|
290
|
-
const way1 = osm.ways.getById(-1);
|
|
291
|
-
const way2 = osm.ways.getById(-2);
|
|
292
|
-
// Each way should have 2 nodes
|
|
293
|
-
expect(way1?.refs).toHaveLength(2);
|
|
294
|
-
expect(way2?.refs).toHaveLength(2);
|
|
295
|
-
// Nodes at the same coordinate are reused
|
|
296
|
-
expect(way1?.refs[1]).toBe(way2?.refs[0]);
|
|
297
|
-
});
|
|
298
|
-
it("should use generator for custom progress handling", () => {
|
|
299
|
-
const osm = new Osm();
|
|
300
|
-
const geojson = {
|
|
301
|
-
type: "FeatureCollection",
|
|
302
|
-
features: [
|
|
303
|
-
{
|
|
304
|
-
type: "Feature",
|
|
305
|
-
geometry: {
|
|
306
|
-
type: "Point",
|
|
307
|
-
coordinates: [-122.4194, 37.7749],
|
|
308
|
-
},
|
|
309
|
-
properties: {},
|
|
310
|
-
},
|
|
311
|
-
],
|
|
312
|
-
};
|
|
313
|
-
const progressMessages = [];
|
|
314
|
-
for (const update of startCreateOsmFromShapefile(osm, geojson, "test")) {
|
|
315
|
-
progressMessages.push(progressEventMessage(update));
|
|
316
|
-
}
|
|
317
|
-
expect(progressMessages.length).toBeGreaterThan(0);
|
|
318
|
-
expect(progressMessages[0]).toContain("Converting");
|
|
319
|
-
expect(progressMessages[progressMessages.length - 1]).toContain("Finished converting");
|
|
320
|
-
});
|
|
321
|
-
it("should use feature IDs when present", () => {
|
|
322
|
-
const osm = new Osm();
|
|
323
|
-
const geojson = {
|
|
324
|
-
type: "FeatureCollection",
|
|
325
|
-
features: [
|
|
326
|
-
{
|
|
327
|
-
type: "Feature",
|
|
328
|
-
id: 100,
|
|
329
|
-
geometry: {
|
|
330
|
-
type: "Point",
|
|
331
|
-
coordinates: [-122.4194, 37.7749],
|
|
332
|
-
},
|
|
333
|
-
properties: {
|
|
334
|
-
name: "Point with ID",
|
|
335
|
-
},
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
type: "Feature",
|
|
339
|
-
id: "200",
|
|
340
|
-
geometry: {
|
|
341
|
-
type: "LineString",
|
|
342
|
-
coordinates: [
|
|
343
|
-
[-122.4194, 37.7749],
|
|
344
|
-
[-122.4094, 37.7849],
|
|
345
|
-
],
|
|
346
|
-
},
|
|
347
|
-
properties: {
|
|
348
|
-
highway: "primary",
|
|
349
|
-
},
|
|
350
|
-
},
|
|
351
|
-
],
|
|
352
|
-
};
|
|
353
|
-
for (const _ of startCreateOsmFromShapefile(osm, geojson, "test")) {
|
|
354
|
-
// Consume generator
|
|
355
|
-
}
|
|
356
|
-
osm.buildIndexes();
|
|
357
|
-
// Point should use ID 100
|
|
358
|
-
const node = osm.nodes.getById(100);
|
|
359
|
-
expect(node).toBeDefined();
|
|
360
|
-
expect(node?.tags?.["name"]).toBe("Point with ID");
|
|
361
|
-
// Way should use ID 200
|
|
362
|
-
const way = osm.ways.getById(200);
|
|
363
|
-
expect(way).toBeDefined();
|
|
364
|
-
expect(way?.tags?.["highway"]).toBe("primary");
|
|
365
|
-
});
|
|
366
|
-
it("should handle MultiLineString features", () => {
|
|
367
|
-
const osm = new Osm();
|
|
368
|
-
const geojson = {
|
|
369
|
-
type: "FeatureCollection",
|
|
370
|
-
features: [
|
|
371
|
-
{
|
|
372
|
-
type: "Feature",
|
|
373
|
-
geometry: {
|
|
374
|
-
type: "MultiLineString",
|
|
375
|
-
coordinates: [
|
|
376
|
-
[
|
|
377
|
-
[-122.4194, 37.7749],
|
|
378
|
-
[-122.4094, 37.7849],
|
|
379
|
-
],
|
|
380
|
-
[
|
|
381
|
-
[-122.3994, 37.7949],
|
|
382
|
-
[-122.3894, 37.8049],
|
|
383
|
-
],
|
|
384
|
-
],
|
|
385
|
-
},
|
|
386
|
-
properties: {
|
|
387
|
-
highway: "secondary",
|
|
388
|
-
},
|
|
389
|
-
},
|
|
390
|
-
],
|
|
391
|
-
};
|
|
392
|
-
for (const _ of startCreateOsmFromShapefile(osm, geojson, "test")) {
|
|
393
|
-
// Consume generator
|
|
394
|
-
}
|
|
395
|
-
osm.buildIndexes();
|
|
396
|
-
// Should create 2 ways (one for each line)
|
|
397
|
-
expect(osm.ways.size).toBe(2);
|
|
398
|
-
expect(osm.nodes.size).toBe(4);
|
|
399
|
-
const way1 = osm.ways.getById(-1);
|
|
400
|
-
const way2 = osm.ways.getById(-2);
|
|
401
|
-
expect(way1?.refs).toHaveLength(2);
|
|
402
|
-
expect(way2?.refs).toHaveLength(2);
|
|
403
|
-
expect(way1?.tags?.["highway"]).toBe("secondary");
|
|
404
|
-
expect(way2?.tags?.["highway"]).toBe("secondary");
|
|
405
|
-
});
|
|
406
|
-
it("should handle MultiPolygon features", () => {
|
|
407
|
-
const osm = new Osm();
|
|
408
|
-
const geojson = {
|
|
409
|
-
type: "FeatureCollection",
|
|
410
|
-
features: [
|
|
411
|
-
{
|
|
412
|
-
type: "Feature",
|
|
413
|
-
geometry: {
|
|
414
|
-
type: "MultiPolygon",
|
|
415
|
-
coordinates: [
|
|
416
|
-
// First polygon
|
|
417
|
-
[
|
|
418
|
-
[
|
|
419
|
-
[-122.4194, 37.7749],
|
|
420
|
-
[-122.4094, 37.7749],
|
|
421
|
-
[-122.4094, 37.7849],
|
|
422
|
-
[-122.4194, 37.7849],
|
|
423
|
-
[-122.4194, 37.7749],
|
|
424
|
-
],
|
|
425
|
-
],
|
|
426
|
-
// Second polygon
|
|
427
|
-
[
|
|
428
|
-
[
|
|
429
|
-
[-122.3994, 37.7649],
|
|
430
|
-
[-122.3894, 37.7649],
|
|
431
|
-
[-122.3894, 37.7749],
|
|
432
|
-
[-122.3994, 37.7749],
|
|
433
|
-
[-122.3994, 37.7649],
|
|
434
|
-
],
|
|
435
|
-
],
|
|
436
|
-
],
|
|
437
|
-
},
|
|
438
|
-
properties: {
|
|
439
|
-
landuse: "residential",
|
|
440
|
-
},
|
|
441
|
-
},
|
|
442
|
-
],
|
|
443
|
-
};
|
|
444
|
-
for (const _ of startCreateOsmFromShapefile(osm, geojson, "test")) {
|
|
445
|
-
// Consume generator
|
|
446
|
-
}
|
|
447
|
-
osm.buildIndexes();
|
|
448
|
-
// Should have 2 ways + 1 relation
|
|
449
|
-
expect(osm.ways.size).toBe(2);
|
|
450
|
-
expect(osm.relations.size).toBe(1);
|
|
451
|
-
const relation = osm.relations.getById(-1);
|
|
452
|
-
expect(relation).toBeDefined();
|
|
453
|
-
expect(relation?.tags?.["type"]).toBe("multipolygon");
|
|
454
|
-
expect(relation?.tags?.["landuse"]).toBe("residential");
|
|
455
|
-
expect(relation?.members).toHaveLength(2);
|
|
456
|
-
expect(relation?.members[0]?.role).toBe("outer");
|
|
457
|
-
expect(relation?.members[1]?.role).toBe("outer");
|
|
458
|
-
});
|
|
459
|
-
});
|
|
460
|
-
//# sourceMappingURL=osm-from-shapefile.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"osm-from-shapefile.test.js","sourceRoot":"","sources":["../../test/osm-from-shapefile.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAA;AAEvE,oBAAoB;AACpB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3B,OAAO,EAAE,KAAK,EAAE,KAAc,EAAE,EAAE;QACjC,sCAAsC;QACtC,OAAO,KAA0B,CAAA;IAClC,CAAC;CACD,CAAC,CAAC,CAAA;AAEH,QAAQ,CAAC,+CAA+C,EAAE,GAAG,EAAE;IAC9D,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QACjD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CA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