-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'symbol-placement: line-center'.
With this placement option, we will attempt to place a single label in the center of each "line" geometry of a feature. If the label doesn't fit or the 'text-max-angle' check fails, we don't place anything. Labels using 'line-center' are allowed to extend past the edge of the tile they're centered in, following line geometry included in the tile's buffers.
- Loading branch information
Showing
16 changed files
with
293 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+21.3 KB
test/integration/render-tests/symbol-placement/line-center-buffer/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions
60
test/integration/render-tests/symbol-placement/line-center-buffer/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"description": "'Carribean Sea' crosses a tile boundary, but we don't draw the tile boundary in the test because JS and Native render tile boundaries differently.", | ||
"height": 256, | ||
"width": 1024 | ||
} | ||
}, | ||
"center": [ | ||
-73, | ||
15 | ||
], | ||
"zoom": 4.5, | ||
"sources": { | ||
"mapbox": { | ||
"type": "vector", | ||
"maxzoom": 14, | ||
"tiles": [ | ||
"local://tiles/mapbox.mapbox-streets-v7/{z}-{x}-{y}.mvt" | ||
] | ||
} | ||
}, | ||
"glyphs": "local://glyphs/{fontstack}/{range}.pbf", | ||
"layers": [ | ||
{ | ||
"id": "background", | ||
"type": "background", | ||
"paint": { | ||
"background-color": "white" | ||
} | ||
}, | ||
{ | ||
"id": "line-center", | ||
"type": "symbol", | ||
"source": "mapbox", | ||
"source-layer": "marine_label", | ||
"layout": { | ||
"text-field": "{name_en}", | ||
"symbol-placement": "line-center", | ||
"text-allow-overlap": true, | ||
"text-size": 50, | ||
"text-letter-spacing": 0.5, | ||
"text-font": [ | ||
"Open Sans Semibold", | ||
"Arial Unicode MS Bold" | ||
] | ||
} | ||
}, | ||
{ | ||
"id": "line", | ||
"type": "line", | ||
"source": "mapbox", | ||
"source-layer": "marine_label", | ||
"paint": { | ||
"line-width": 1 | ||
} | ||
} | ||
] | ||
} |
Binary file added
BIN
+52.7 KB
test/integration/render-tests/symbol-placement/line-center/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.