map-design
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMap Design
地图设计
You cannot draw a coastline from memory, and neither can any model. This skill
gives you real geography: bundled boundary data, an offline gazetteer, proper
projections, and a renderer with an editorial design system. You write a short
JSON spec; the CLI draws the map.
Never hand-write map geometry, SVG paths or coordinates for countries,
coasts or borders. Always go through .
scripts/map.mjs<skill-dir>你不能凭记忆绘制海岸线,任何模型也不能。此 Skill 提供真实地理信息:内置边界数据、离线地名库、恰当的地图投影,以及采用出版物级设计系统的渲染器。你只需编写简短的 JSON 规范;CLI 就会绘制地图。
绝不要手动编写国家、海岸线或边界的地图几何图形、SVG 路径或坐标。 始终通过 完成。
scripts/map.mjs下文中的 表示此 Skill 的基础目录。CLI 除 Node.js 20+ 外不需要任何其他依赖。如果本地安装了 Chrome、Edge、Brave 或 Chromium,PNG 导出将使用其中之一;HTML 和 SVG 则始终可用。
<skill-dir>Workflow
工作流
- Pick the kind from the table below. If the request is ambiguous, choose the closest kind and state the choice; ask only when the data is missing.
- Get the data. Use the user's file as is (CSV or JSON, path relative to
the spec). For public statistics, fetch from a primary source and record it
in . Never invent values. If you must show placeholder numbers, say so in
sourceorsubtitle.note - Write the spec as where the outputs should go. Start from the matching example in references/spec.md.
<name>.json - Run . It writes
node <skill-dir>/scripts/map.mjs render <name>.json,<name>.htmland<name>.svgnext to the spec and prints what it matched.<name>.png - Read the report. Fix every row (use the suggestions, an ISO code, or
NOT MATCHED/lon) and every ambiguity warning, then render again.latvalidates without writing.node <skill-dir>/scripts/map.mjs check <name>.json - Look at the PNG before you call it done. Check that the title states the point, labels are legible, nothing important is cut off, and the legend matches the data. Adjust and re-render; one or two passes is normal.
- Deliver the file paths, the data source, and anything left unmatched.
- 选择类型。 从下表中选择最合适的类型。如果请求不明确,选择最接近的类型并说明所选类型;仅在缺少数据时询问。
- 获取数据。 按原样使用用户提供的文件(CSV 或 JSON,路径相对于规范文件)。对于公开统计数据,应从一手来源获取并在 中记录。绝不编造数值。如果必须显示占位数字,请在
source或subtitle中说明。note - 编写规范。 将规范编写为 ,输出文件将放在同一目录。以 references/spec.md 中匹配的示例开始。
<name>.json - 运行渲染器。 执行 。它会在规范文件旁写入
node <skill-dir>/scripts/map.mjs render <name>.json、<name>.html和<name>.svg,并打印匹配到的内容。<name>.png - 阅读报告。 修复每一个 行(使用建议项、ISO 代码或
NOT MATCHED/lon)以及每一条歧义警告,然后重新渲染。lat可在不写入文件的情况下进行验证。node <skill-dir>/scripts/map.mjs check <name>.json - 查看 PNG。 完成前检查 PNG。确认标题明确表达核心结论、标签清晰可辨、重要内容未被裁切,并且图例与数据匹配。调整后重新渲染;通常需要一至两轮。
- 交付结果。 提供文件路径、数据源以及所有未匹配项。
Choosing a kind
选择类型
| The user has or wants | kind | Notes |
|---|---|---|
| A rate or share per country, state, province or county | | Rates, not raw counts. |
| Counts or totals at places | | Circle area ∝ value. |
| Many values at points, dense areas | | Height ∝ value; good for population. |
| Locations, optionally by category | | Stores, offices, sightings. |
| An ordered trip, voyage or itinerary | | |
| Movement between places with volume | | Migration, trade, flights. |
| "Where is X?" | | Highlight a country, region or place, with an inset globe. |
| A city or neighborhood as art | | Streets from OpenStreetMap; needs network. |
Raw counts on a choropleth mostly show which areas are large. Divide by
population or area, or switch to . The CLI warns when a value column
looks like a count.
bubbles| 用户拥有或需要的内容 | kind | 备注 |
|---|---|---|
| 各国、各州、各省或各县的比例或占比 | | 使用比率,而非原始计数。 |
| 各地点的计数或总量 | | 圆面积 ∝ 数值。 |
| 点位上有大量数值且区域密集 | | 高度 ∝ 数值;适合表示人口。 |
| 位置,可按类别划分 | | 门店、办公室、目击事件等。 |
| 有序的旅行、航行或行程 | | |
| 地点之间带数量或体量的移动 | | 迁移、贸易、航班等。 |
| “X 在哪里?” | | 突出显示国家、地区或地点,并附带插图地球仪。 |
| 将城市或社区作为艺术作品呈现 | | 街道来自 OpenStreetMap;需要网络连接。 |
在分级设色图上使用原始计数通常只会显示哪些区域面积较大。应除以人口或面积,或者改用 。当数值列看起来像计数时,CLI 会发出警告。
bubblesSpec essentials
规范要点
json
{
"kind": "choropleth",
"title": "Where people are packed in",
"subtitle": "People per square kilometre, by country",
"data": "builtin:countries",
"join": "iso3",
"value": "density",
"scale": { "type": "threshold", "breaks": [10, 25, 50, 100, 250], "palette": "purple" },
"legend": { "title": "People per km²" },
"source": "Natural Earth (2019 estimates)"
}This one runs as is: is bundled.
builtin:countries- :
region(default; Antarctica cropped unless"world"),"antarctica": true, a continent or area ("usa","europe","africa", …), one country ("south asia","IND"), a list of countries,"Brazil", or[west, south, east, north]to frame the data."auto" - Locations in rows: /
lon,lat,iata(+ optionalplace),country, UScountry, orstate+admin1. Gazetteer place names cover about 7,300 cities and towns; anything smaller needscountry/lon.lat - :
theme(default),paper,atlas,ink,antique,swiss. Posters:blueprint,noir,paper,blueprint,sumi,terracotta,azulejo,neon,forest.mono - :
size,landscape,wide,square,portrait,story, orposter. Default: chosen from the region's shape.{ "width": W, "height": H } - :
annotations.[{ "at": "Lagos", "text": "Africa's largest city\n15.4 million", "dx": 60, "dy": -40 }]
Everything else, per kind: references/spec.md.
json
{
"kind": "choropleth",
"title": "Where people are packed in",
"subtitle": "People per square kilometre, by country",
"data": "builtin:countries",
"join": "iso3",
"value": "density",
"scale": { "type": "threshold", "breaks": [10, 25, 50, 100, 250], "palette": "purple" },
"legend": { "title": "People per km²" },
"source": "Natural Earth (2019 estimates)"
}该规范可直接运行: 已内置。
builtin:countries- :
region(默认;除非设置"world",否则会裁剪南极洲)、"antarctica": true、某个洲或区域("usa"、"europe"、"africa"等)、单个国家("south asia"、"IND")、国家列表、"Brazil",或用于自动取景的[west, south, east, north]。"auto" - 行中的位置:/
lon、lat、iata(+ 可选place)、country、美国country,或state+admin1。地名库涵盖约 7,300 个城市和城镇;更小的地点需要提供country/lon。lat - :
theme(默认)、paper、atlas、ink、antique、swiss。海报主题:blueprint、noir、paper、blueprint、sumi、terracotta、azulejo、neon、forest。mono - :
size、landscape、wide、square、portrait、story,或poster。默认根据区域形状自动选择。{ "width": W, "height": H } - :
annotations。[{ "at": "Lagos", "text": "Africa's largest city\n15.4 million", "dx": 60, "dy": -40 }]
其他内容因类型而异,请参阅 references/spec.md。
Basemaps (street-level detail)
底图(街道级细节)
The bundled Natural Earth geography is designed for country-scale maps. For streets
under the data, add a basemap. Prefer : vector roads, water, parks and
buildings coloured by the map's theme, sharp at any size, in any projection, with
street and park names on hover in the HTML. No key needed.
"streets"json
{ "kind": "points", "basemap": "streets", "theme": "ink",
"region": { "center": [12.55, 55.68], "radiusKm": 6 } }Raster presets embed tile images instead: , , and are
keyless; and the presets need a provider key in a custom URL.
They force Mercator. The default budget is 144 distinct tiles; applies to
both kinds. validates configuration without fetching tiles or writing
caches. Keep the generated attribution and copyright links visible.
osmosm-hotlightdarkvoyagercarto-*maxTilescheckBefore choosing a provider, read basemap options and provider terms.
OSM, OSM France and CARTO have different access, cache and export requirements;
self-contained output does not grant permission for every use. Use your own tile
service or a provider permitting your workload for bulk or offline map products.
内置的 Natural Earth 地理数据适用于国家尺度地图。若需要数据所覆盖区域以下的街道信息,请添加底图。优先使用 :矢量道路、水体、公园和建筑会按地图主题着色,在任意尺寸和投影下都保持清晰,并且 HTML 中悬停时可显示街道和公园名称。无需密钥。
"streets"json
{ "kind": "points", "basemap": "streets", "theme": "ink",
"region": { "center": [12.55, 55.68], "radiusKm": 6 } }栅格预设会嵌入瓦片图像:、、 和 无需密钥; 和 预设则需要在自定义 URL 中提供服务商密钥。它们强制使用 Mercator 投影。默认预算为 144 张不同瓦片; 同时适用于两种底图。 会在不获取瓦片或写入缓存的情况下验证配置。请保持生成的署名和版权链接可见。
osmosm-hotlightdarkvoyagercarto-*maxTilescheck选择服务商前,请阅读底图选项和服务商条款。OSM、OSM France 和 CARTO 在访问、缓存及导出方面具有不同要求;自包含输出并不意味着可以用于所有场景。对于批量或离线地图产品,请使用自己的瓦片服务,或选择允许此类工作负载的服务商。
Design rules
设计规则
- The title states the finding; the subtitle says what is measured, where and when.
- Always set . Add
sourcefor caveats (estimates, missing data, borders).note - 4–6 classes for choropleths. Use for even groups,
quantilewith round breaks when the numbers mean something to readers,thresholdfor clusters.jenks - Sequential palettes for magnitude; diverging (,
red-blue, …) only with a meaningful midpoint, set viabrown-teal.scale.center - Do not add Mercator to world maps; the defaults (Equal Earth, conic, azimuthal
equal-area, Albers USA) already preserve area. Use for an orthographic view.
"projection": "globe" - Label sparingly: the top values, the places the story is about. The renderer drops overlapping labels and lists them in the report.
- Pick the theme for the audience: or
paperfor reports,swissfor slides and dark UIs,inkfor reference,atlasfor history.antique
More guidance with examples: references/cartography.md.
- 标题应点明核心结论;副标题应说明测量内容、地区和时间。
- 始终设置 。对于估算值、缺失数据或边界等注意事项,请添加
source。note - 分级设色图使用 4–6 个分级。适合创建大小均衡的分组;当数值对读者具有明确含义时,使用带合理整数分界点的
quantile;threshold适合识别聚类。jenks - 数量级数据使用顺序色板;仅在存在有意义中点时使用发散色板(、
red-blue等),并通过brown-teal设置中点。scale.center - 不要为世界地图添加 Mercator 投影;默认投影(Equal Earth、conic、azimuthal equal-area、Albers USA)已经能够保持面积。设置 可使用正射视图。
"projection": "globe" - 谨慎添加标签:仅标注最高值和故事重点地点。渲染器会移除重叠标签,并在报告中列出这些标签。
- 按受众选择主题:报告使用 或
paper;幻灯片和深色界面使用swiss;参考资料使用ink;历史内容使用atlas。antique
更多指导和示例:references/cartography.md。
Data you can use without fetching anything
无需联网即可使用的数据
- gives
"data": "builtin:countries",iso3,name,continent,region,population,gdpMillionsUsd,gdpPerCapita,areaKm2anddensityfor every country (Natural Earth, 2019 estimates). Cite it as "Natural Earth (2019 estimates)".income - looks up anything in the bundled data:
find.node <skill-dir>/scripts/map.mjs find "Springfield" --country USA
Datasets, join keys, licenses and border caveats: references/data.md.
- 提供每个国家的
"data": "builtin:countries"、iso3、name、continent、region、population、gdpMillionsUsd、gdpPerCapita、areaKm2和density(Natural Earth,2019 年估算值)。请将其引用为income。"Natural Earth (2019 estimates)" - 可查询内置数据中的任何内容:
find。node <skill-dir>/scripts/map.mjs find "Springfield" --country USA
有关数据集、连接键、许可证和边界注意事项,请参阅 references/data.md。
City posters
城市海报
bash
node <skill-dir>/scripts/map.mjs poster --place "Lisbon" --country PRT --theme azulejo --radius 4Or a spec with . is half the poster's width on the
ground: 1.5–3 for an old town (building footprints fill the blocks), 4–6 for a city
center, 10–30 for a whole metro as fine street lace. Add (or
in a spec) to mark a spot. Neighborhoods and landmarks need
coordinates: ask the user rather than guessing. Posters download OpenStreetMap
vector tiles from OpenFreeMap (Overpass as fallback) and cache them. Keep the
generated credit: "© OpenMapTiles.org © OpenStreetMap contributors" for vector
tiles, or "© OpenStreetMap contributors" for Overpass. The HTML shows hover
details for supported features with names in the source data.
Details: references/posters.md.
"kind": "poster"radiusKm--pin "Label"markersbash
node <skill-dir>/scripts/map.mjs poster --place "Lisbon" --country PRT --theme azulejo --radius 4也可以使用包含 的规范。 是海报地面宽度的半径:老城区为 1.5–3(建筑轮廓会填满街区),市中心为 4–6,整个都会区为 10–30,以呈现精细的街道网络。添加 (或在规范中使用 )来标记位置。社区和地标需要坐标:请询问用户,不要猜测。海报会从 OpenFreeMap 下载 OpenStreetMap 矢量瓦片(以 Overpass 作为回退)并进行缓存。使用矢量瓦片时,请保留生成的版权信息:“© OpenMapTiles.org © OpenStreetMap contributors”;使用 Overpass 时,请保留:“© OpenStreetMap contributors”。HTML 会为源数据中包含名称的受支持要素显示悬停详情。
"kind": "poster"radiusKm--pin "Label"markers详情:references/posters.md。
When something goes wrong
出现问题时
- : use the suggested match, add
Could not locate "X", or givecountry/lon.lat - : use ISO alpha-3 codes in the join column.
matched no countries feature - A point "falls outside this projection": Albers USA only covers the 50 states
and DC; use or a bbox.
"region": "auto" - No PNG: no supported browser was found. Set to a Chrome or Edge binary, or use the HTML's PNG button.
MAP_DESIGN_BROWSER - Overpass errors for posters: wait a minute and retry, reduce , or set
radiusKmto another endpoint."overpass"
- :使用建议的匹配项,添加
Could not locate "X",或提供country/lon。lat - :在连接列中使用 ISO alpha-3 代码。
matched no countries feature - 点“超出此投影范围”:Albers USA 仅覆盖美国 50 个州和哥伦比亚特区(DC);请改用 或边界框。
"region": "auto" - 没有 PNG:未找到受支持的浏览器。请将 设置为 Chrome 或 Edge 可执行文件,或者使用 HTML 中的 PNG 按钮。
MAP_DESIGN_BROWSER - 海报的 Overpass 报错:等待一分钟后重试、减小 ,或将
radiusKm设置为其他端点。"overpass"