iT邦幫忙

2025 iThome 鐵人賽

DAY 28
0

mercator 套件可以輕鬆地把 geojson 檔案內描述的地圖生成對應的 SVG 圖片,並且顯示在 typst 文件中。下面的例子中,我們可以用 g0v 製作的 twgeojson 繪製台灣輪廓。

#show raw.where(lang: "geojson"): it => mercator.render-map(it.text, config)

#let tw = read("twCounty2010.geo.json", encoding: "utf8")
#let config3 = json.encode((
  "stroke": "blue",
  "stroke_width": 0.01,
  "fill": "white",
  "fill_opacity": 0.5,
  show_labels: false))

#figure(render-map(tw, config3, height:400pt), caption: "Taiwan")

https://ithelp.ithome.com.tw/upload/images/20250911/20112376oYZYB5Xwje.png


上一篇
Day 27: 各種雜文產生器
下一篇
Day 29: 執行簡單的程式
系列文
Typst 與 CeTZ:對演算法與程式設計超友好的排版製圖工具29
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言