@versatiles/svg-renderer 0.7.0 → 0.7.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/README.md +20 -10
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Renders vector maps as SVG.
|
|
|
12
12
|
|
|
13
13
|
[Download SVG](docs/demo.svg)
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Supported layer types: background, fill, line, circle, symbol, and raster.
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
@@ -103,15 +103,25 @@ new SVGExportControl({
|
|
|
103
103
|
|
|
104
104
|
### `renderToSVG(options): Promise<string>`
|
|
105
105
|
|
|
106
|
-
| Option
|
|
107
|
-
|
|
|
108
|
-
| `style`
|
|
109
|
-
| `width`
|
|
110
|
-
| `height`
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
106
|
+
| Option | Type | Default | Description |
|
|
107
|
+
| -------------- | -------------------- | ------------ | ----------------------------------------- |
|
|
108
|
+
| `style` | `StyleSpecification` | *(required)* | MapLibre style specification |
|
|
109
|
+
| `width` | `number` | `1024` | Output width in pixels |
|
|
110
|
+
| `height` | `number` | `1024` | Output height in pixels |
|
|
111
|
+
| `lon` | `number` | `0` | Center longitude |
|
|
112
|
+
| `lat` | `number` | `0` | Center latitude |
|
|
113
|
+
| `zoom` | `number` | `2` | Zoom level |
|
|
114
|
+
| `renderLabels` | `boolean` | `false` | Enable rendering of text labels and icons |
|
|
115
|
+
|
|
116
|
+
### About `renderLabels`
|
|
117
|
+
|
|
118
|
+
When `renderLabels` is set to `true`, symbol layers are rendered, including text labels and sprite-based icons. By default, this option is disabled.
|
|
119
|
+
|
|
120
|
+
> [!WARNING]
|
|
121
|
+
> The rendering of labels and icons is experimental and may produce imperfect results. Since we cannot use the original layouting engine of MapLibre GL JS, there are known limitations:
|
|
122
|
+
>
|
|
123
|
+
> - **No collision detection:** Text labels are rendered without collision detection, so labels may overlap.
|
|
124
|
+
> - **Simplified text placement:** Labels can not be positioned along lines.
|
|
115
125
|
|
|
116
126
|
## E2E Visual Comparison
|
|
117
127
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versatiles/svg-renderer",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Renders vector maps as SVG.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svg",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"check": "npm run format && npm run lint && npm run typecheck && npm run build && npm run test && npm run test:e2e",
|
|
53
53
|
"demo": "tsx src/demo.ts",
|
|
54
54
|
"dev": "tsx dev/serve.ts",
|
|
55
|
+
"dev:render-comparison": "tsx dev/render-comparison.ts",
|
|
55
56
|
"doc:graph": "vrt deps-graph | vrt doc-insert README.md '## Dependency Graph'",
|
|
56
57
|
"doc:typescript": "npx vrt doc-typescript -f html -o ./doc-typescript",
|
|
57
58
|
"format": "prettier --write --log-level warn .",
|
|
@@ -59,12 +60,12 @@
|
|
|
59
60
|
"prepack": "npm run doc:graph && npm run build",
|
|
60
61
|
"release": "npx vrt release-npm",
|
|
61
62
|
"start": "tsx src/index.ts",
|
|
62
|
-
"
|
|
63
|
+
"test": "vitest run",
|
|
63
64
|
"test:coverage": "vitest run --coverage",
|
|
64
65
|
"test:e2e:maplibre": "tsx e2e/maplibre-control.ts",
|
|
65
66
|
"test:e2e:screenshots": "tsx e2e/screenshots.ts",
|
|
66
67
|
"test:e2e": "vitest run --config vitest.e2e.config.ts && npm run test:e2e:maplibre && npm run test:e2e:screenshots",
|
|
67
|
-
"
|
|
68
|
+
"typecheck": "tsc --noEmit",
|
|
68
69
|
"upgrade": "npm-check-updates -u -t minor; rm -f package-lock.json; rm -rf node_modules; npm i"
|
|
69
70
|
},
|
|
70
71
|
"sideEffects": false,
|