map-zero 0.1.0 → 0.2.1
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 +14 -0
- package/README.md +31 -2
- package/docs/cesium.md +24 -9
- package/package.json +4 -3
- package/packages/cesium/package.json +6 -3
- package/packages/cesium/src/imagery-worker.js +604 -0
- package/packages/cesium/src/imagery.js +434 -0
- package/packages/cesium/src/index.js +199 -35
- package/packages/ol/package.json +1 -1
- package/packages/ol/src/index.js +349 -16
- package/src/3dtiles/b3dm.js +18 -2
- package/src/3dtiles/clipper-surfaces.js +121 -20
- package/src/3dtiles/export.js +298 -25
- package/src/3dtiles/extrude.js +78 -23
- package/src/3dtiles/flat.js +8 -20
- package/src/3dtiles/glb.js +78 -27
- package/src/3dtiles/gpkg-features.js +4 -4
- package/src/3dtiles/precision.js +47 -0
- package/src/cli.js +100 -2
- package/src/export-pmtiles.js +17 -16
- package/src/from-bbox.js +335 -0
- package/src/gpkg-read.js +15 -2
- package/src/html.js +28 -17
- package/src/manifest.js +1 -8
- package/src/mvt.js +35 -3
- package/src/package.js +343 -0
- package/src/server.js +38 -10
- package/src/style-command.js +1 -1
- package/src/style-filters.js +2 -3
- package/styles/presets/neon-dark-3d.json +0 -90
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
- Fixed OpenLayers map-zero z-index handling so map-zero layers behave as a single ordered group and labels no longer render above dynamic application layers.
|
|
6
|
+
|
|
7
|
+
## 0.2.0
|
|
8
|
+
|
|
9
|
+
- Simplified `.mapzero` manifests to use string layer lists, shared 2D/3D styles, and a single 3D buildings tileset.
|
|
10
|
+
- Added bbox-driven package generation and portable package zip export commands.
|
|
11
|
+
- Improved PMTiles exports, tile bounds handling, and large-area export guidance.
|
|
12
|
+
- Added Cesium context overlay rendering from vector PMTiles through a shared OffscreenCanvas worker.
|
|
13
|
+
- Added OpenLayers raster-worker rendering with HiDPI tiles for matching Cesium/OpenLayers visual output.
|
|
14
|
+
- Improved Cesium 3D building output with normals, material handling, clipping precision, and streaming defaults.
|
|
15
|
+
- Removed the legacy `neon-dark-3d` preset in favor of shared style presets.
|
|
16
|
+
|
|
3
17
|
## 0.1.0
|
|
4
18
|
|
|
5
19
|
Initial alpha release.
|
package/README.md
CHANGED
|
@@ -54,6 +54,16 @@ Build a package:
|
|
|
54
54
|
node src/cli.js build ./data/madrid.osm.pbf --out ./madrid.mapzero
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
Or build the complete static package directly from a bbox:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
node src/cli.js from-bbox \
|
|
61
|
+
--bbox -3.9,40.3,-3.5,40.6 \
|
|
62
|
+
--out ./madrid.mapzero
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`from-bbox` downloads and caches the smallest Geofabrik `.osm.pbf` extract that fully contains the bbox, then runs `build`, `pmtiles`, `3dtiles`, and `package`. The source PBF cache defaults to `~/.cache/map-zero/osm`.
|
|
66
|
+
|
|
57
67
|
Serve it:
|
|
58
68
|
|
|
59
69
|
```bash
|
|
@@ -118,7 +128,7 @@ Export Cesium-ready 3D Tiles:
|
|
|
118
128
|
node src/cli.js 3dtiles ./madrid.mapzero
|
|
119
129
|
```
|
|
120
130
|
|
|
121
|
-
Buildings are extruded. Roads, railways, boundaries, water, landuse, and AIP/aeronautical features are exported as flat cartographic meshes
|
|
131
|
+
Buildings are extruded into streamed Cesium tiles. The default subdivision is tuned for dense cities like Madrid; use `--max-depth` and `--max-features` only when you need coarser or finer tiles. Roads, railways, boundaries, water, landuse, and AIP/aeronautical features are exported as flat cartographic meshes when requested with `--layers`. The Cesium viewer is available at:
|
|
122
132
|
|
|
123
133
|
```text
|
|
124
134
|
http://localhost:8080/cesium
|
|
@@ -126,8 +136,27 @@ http://localhost:8080/cesium
|
|
|
126
136
|
|
|
127
137
|
3D Tiles are also static files. Once exported, they do not need the map-zero Node server; Cesium can load them from any normal static web server.
|
|
128
138
|
|
|
139
|
+
The Cesium PMTiles context overlay uses a module worker plus `OffscreenCanvas`;
|
|
140
|
+
there is no main-thread rasterization fallback.
|
|
141
|
+
|
|
129
142
|
Use `map-zero serve` to preview the Cesium output locally; use static hosting to publish the exported `3dtiles/` folder.
|
|
130
143
|
|
|
144
|
+
## Portable ZIP
|
|
145
|
+
|
|
146
|
+
Create a zip ready to copy into an app:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
node src/cli.js package ./madrid.mapzero
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
By default this writes `madrid.mapzero.zip` next to the package and includes `manifest.json`, the styles referenced by the manifest, `tiles.pmtiles`, and `3dtiles/`. The source GeoPackage is excluded because static OpenLayers/Cesium consumers do not need it.
|
|
153
|
+
|
|
154
|
+
Include `data.gpkg` explicitly when you want to keep the source package data in the archive:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
node src/cli.js package ./madrid.mapzero --include-gpkg
|
|
158
|
+
```
|
|
159
|
+
|
|
131
160
|
## OpenLayers Usage
|
|
132
161
|
|
|
133
162
|
Use `@map-zero/ol` to add a package to an existing OpenLayers map:
|
|
@@ -168,7 +197,7 @@ const viewer = new Viewer('cesiumContainer');
|
|
|
168
197
|
const controller = await addMapZeroToCesium(viewer, {
|
|
169
198
|
id: 'huelva',
|
|
170
199
|
manifestUrl: './huelva.mapzero/manifest.json',
|
|
171
|
-
style: '
|
|
200
|
+
style: 'default'
|
|
172
201
|
});
|
|
173
202
|
|
|
174
203
|
controller.setOpacity('buildings', 0.8);
|
package/docs/cesium.md
CHANGED
|
@@ -11,7 +11,7 @@ const viewer = new Viewer('cesiumContainer');
|
|
|
11
11
|
const controller = await addMapZeroToCesium(viewer, {
|
|
12
12
|
id: 'huelva',
|
|
13
13
|
manifestUrl: './huelva.mapzero/manifest.json',
|
|
14
|
-
style: '
|
|
14
|
+
style: 'default'
|
|
15
15
|
});
|
|
16
16
|
```
|
|
17
17
|
|
|
@@ -21,15 +21,13 @@ const controller = await addMapZeroToCesium(viewer, {
|
|
|
21
21
|
node src/cli.js 3dtiles ./huelva.mapzero
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
By default, the exporter writes
|
|
24
|
+
By default, the exporter writes the building 3D Tiles layer:
|
|
25
25
|
|
|
26
26
|
- `buildings`
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- `roads`
|
|
32
|
-
- `boundaries`
|
|
27
|
+
|
|
28
|
+
The default tiling uses `--max-depth 8 --max-features 1500`, which keeps dense
|
|
29
|
+
city exports split into smaller b3dm files so Cesium can stream and cull them
|
|
30
|
+
instead of parsing a few very large tiles.
|
|
33
31
|
|
|
34
32
|
Use `--layers` for a smaller export:
|
|
35
33
|
|
|
@@ -54,11 +52,28 @@ Optional tactical defaults:
|
|
|
54
52
|
```js
|
|
55
53
|
await addMapZeroToCesium(viewer, {
|
|
56
54
|
manifestUrl: './huelva.mapzero/manifest.json',
|
|
57
|
-
style: '
|
|
55
|
+
style: 'default',
|
|
58
56
|
applyDefaultSceneStyle: true
|
|
59
57
|
});
|
|
60
58
|
```
|
|
61
59
|
|
|
60
|
+
The Cesium PMTiles context overlay rasterizes in a module worker with
|
|
61
|
+
`OffscreenCanvas`. Browsers must support `Worker`, `OffscreenCanvas`, and
|
|
62
|
+
`createImageBitmap`; there is no main-thread rasterization fallback.
|
|
63
|
+
|
|
64
|
+
The worker is exported as `@map-zero/cesium/imagery-worker.js`. Most bundlers
|
|
65
|
+
can copy or fingerprint that file and pass the final URL to the helper:
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
await addMapZeroToCesium(viewer, {
|
|
69
|
+
manifestUrl: './huelva.mapzero/manifest.json',
|
|
70
|
+
contextWorkerUrl: new URL('@map-zero/cesium/imagery-worker.js', import.meta.url)
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
If your framework uses a different asset convention, resolve the worker however
|
|
75
|
+
that framework expects and pass the resulting URL as `contextWorkerUrl`.
|
|
76
|
+
|
|
62
77
|
You can also provide your own scene hook:
|
|
63
78
|
|
|
64
79
|
```js
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "map-zero",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Offline vector map packages from OSM, ready for GeoPackage, PMTiles, and 3D Tiles.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
8
|
-
"map-zero": "
|
|
8
|
+
"map-zero": "src/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"dev": "node src/cli.js --help",
|
|
12
12
|
"start": "node src/cli.js",
|
|
13
|
-
"check": "node --check src/cli.js && node --check src/build.js && node --check src/osm.js && node --check src/gpkg.js && node --check src/gpkg-read.js && node --check src/geometry-read.js && node --check src/html.js && node --check src/server.js && node --check src/mvt.js && node --check src/pmtiles.js && node --check src/pmtiles-worker.js && node --check src/export-pmtiles.js && node --check src/3dtiles/b3dm.js && node --check src/3dtiles/glb.js && node --check src/3dtiles/extrude.js && node --check src/3dtiles/flat.js && node --check src/3dtiles/clipper-surfaces.js && node --check src/3dtiles/gpkg-buildings.js && node --check src/3dtiles/gpkg-features.js && node --check src/3dtiles/tileset.js && node --check src/3dtiles/export.js && node --check test-3dtiles/generate-clipper-roads.mjs && node --check test-3dtiles/generate-clipper-roads-from-gpkg.mjs && node --check src/tile-cache.js && node --check src/style-filters.js && node --check src/style-command.js && node --check src/style-presets.js && node --check src/style-themes.js && node --check src/ol.js && node --check packages/ol/src/index.js && node --check packages/ol/src/labels.js && node --check packages/cesium/src/index.js && node --check src/layers.js && node --check src/style.js && node --check src/manifest.js && node --check src/utils.js"
|
|
13
|
+
"check": "node --check src/cli.js && node --check src/build.js && node --check src/osm.js && node --check src/gpkg.js && node --check src/gpkg-read.js && node --check src/geometry-read.js && node --check src/html.js && node --check src/server.js && node --check src/mvt.js && node --check src/pmtiles.js && node --check src/pmtiles-worker.js && node --check src/export-pmtiles.js && node --check src/package.js && node --check src/from-bbox.js && node --check src/3dtiles/b3dm.js && node --check src/3dtiles/glb.js && node --check src/3dtiles/extrude.js && node --check src/3dtiles/flat.js && node --check src/3dtiles/clipper-surfaces.js && node --check src/3dtiles/gpkg-buildings.js && node --check src/3dtiles/gpkg-features.js && node --check src/3dtiles/tileset.js && node --check src/3dtiles/export.js && node --check test-3dtiles/generate-clipper-roads.mjs && node --check test-3dtiles/generate-clipper-roads-from-gpkg.mjs && node --check src/tile-cache.js && node --check src/style-filters.js && node --check src/style-command.js && node --check src/style-presets.js && node --check src/style-themes.js && node --check src/ol.js && node --check packages/ol/src/index.js && node --check packages/ol/src/labels.js && node --check packages/cesium/src/index.js && node --check packages/cesium/src/imagery.js && node --check packages/cesium/src/imagery-worker.js && node --check src/layers.js && node --check src/style.js && node --check src/manifest.js && node --check src/utils.js"
|
|
14
14
|
},
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=20"
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"commander": "^14.0.0",
|
|
42
42
|
"earcut": "^3.0.2",
|
|
43
43
|
"fastify": "^5.8.5",
|
|
44
|
+
"fflate": "^0.8.2",
|
|
44
45
|
"geojson-vt": "^4.0.2",
|
|
45
46
|
"js-angusj-clipper": "^1.3.1",
|
|
46
47
|
"osm-pbf-parser": "^2.3.0",
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@map-zero/cesium",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Cesium integration helper for map-zero 3D Tiles packages.",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"exports": {
|
|
8
|
-
".": "./src/index.js"
|
|
8
|
+
".": "./src/index.js",
|
|
9
|
+
"./imagery-worker.js": "./src/imagery-worker.js"
|
|
9
10
|
},
|
|
10
11
|
"peerDependencies": {
|
|
11
|
-
"cesium": "^1.141.0"
|
|
12
|
+
"cesium": "^1.141.0",
|
|
13
|
+
"ol": "^10.9.0",
|
|
14
|
+
"pmtiles": "^4.4.1"
|
|
12
15
|
}
|
|
13
16
|
}
|