Skip to content

Commit

Permalink
低ズームの地名から市を削除する
Browse files Browse the repository at this point in the history
  • Loading branch information
naogify committed Dec 15, 2022
1 parent 8cb50ad commit c9ef1dc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions layers/components/remove-place-suffix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 市」を削除するために、文字数に応じて最後の文字以外を取得する。
# TODO: タイル側で対応する。
[
"match",
["length", ["get", "name"]],
2, ["get", "name"], # 2文字の場合はそのまま表示
3, ["slice", ["get", "name"], 0, 2], # 3文字の場合は最後の文字を削除
4, ["slice", ["get", "name"], 0, 3], # 4文字の場合は最後の文字を削除
5, ["slice", ["get", "name"], 0, 4], # 5文字の場合は最後の文字を削除
["get", "name"] # フォールバック
]
2 changes: 1 addition & 1 deletion layers/oc-label-pref-capital-ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ layout:
icon-image: circle-stroked
icon-size: 0.8
icon-allow-overlap: true
text-field: '{name}'
text-field: !!inc/file layers/components/remove-place-suffix.yml
text-offset:
- 0.6
- 0.6
Expand Down
2 changes: 1 addition & 1 deletion layers/oc-label-pref-capital-popular-ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ layout:
icon-image: circle-stroked
icon-size: 0.8
icon-allow-overlap: true
text-field: '{name}'
text-field: !!inc/file layers/components/remove-place-suffix.yml
text-offset:
- 0.6
- 0.6
Expand Down
2 changes: 1 addition & 1 deletion layers/oc-label-town-ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ layout:
text-anchor: top
icon-image: circle-stroked
icon-size: 0.8
text-field: '{name}'
text-field: !!inc/file layers/components/remove-place-suffix.yml
text-offset:
- 0
- 0.6
Expand Down

0 comments on commit c9ef1dc

Please sign in to comment.