Mapbox Cartography Skill
This skill provides expert cartographic knowledge to help you design effective, beautiful, and functional maps using Mapbox.
Core Cartographic Principles
Visual Hierarchy
Maps must guide the viewer's attention to what matters most:
- - Most important: POIs, user location, route highlights
- Secondary: Major roads, city labels, landmarks
- Tertiary: Minor streets, administrative boundaries
- Background: Water, land use, terrain
Implementation:
- - Use size, color intensity, and contrast to establish hierarchy
- Primary features: high contrast, larger symbols, bold colors
- Background features: low contrast, muted colors, smaller text
Color Theory for Maps
Color Harmony:
- - Analogous colors: Use colors next to each other on color wheel (blue-green-teal) for cohesive designs
- Complementary colors: Use opposite colors (blue/orange, red/green) for high contrast emphasis
- Monochromatic: Single hue with varying saturation/brightness for elegant, minimal designs
Color Psychology:
- - Blue: Water, trust, calm, professional (default for water bodies)
- Green: Parks, nature, growth, eco-friendly (vegetation, parks)
- Red/Orange: Urgent, important, dining (alerts, restaurants)
- Yellow: Caution, highlight, attention (warnings, selected items)
- Gray: Neutral, background, roads (infrastructure)
Accessibility:
- - Ensure 4.5:1 contrast ratio for text (WCAG AA)
- Don't rely solely on color to convey information
- Test designs with colorblind simulators
- Avoid red/green combinations for critical distinctions
Color Palette Templates:
Light Theme (Day/Professional):
CODEBLOCK0
Dark Theme (Night Mode):
CODEBLOCK1
Road color rule for dark themes: Roads must use neutral dark gray (#3a3a3a), visibly distinct from the background but not colored. Never style roads with amber, blue, or other hues — reserve color for app data layers (routes, markers). Colored base roads and colored data layers will compete visually. Local roads that blend into the background (#1e1e1e on #1a1a1a) create a "floating labels" problem where street names appear with no visible road beneath them.
High Contrast (Accessibility):
CODEBLOCK2
Vintage/Retro:
CODEBLOCK3
Typography at Map Scale
Font Selection:
- - Sans-serif (Roboto, Open Sans): Modern, clean, high legibility at small sizes - use for labels
- Serif (Noto Serif): Traditional, formal - use sparingly for titles or historic maps
- Monospace: Technical data, coordinates
Text Sizing:
CODEBLOCK4
Label Placement:
- - Point labels: Center or slightly offset (avoid overlap with symbol)
- Line labels: Follow line curve, repeat for long features
- Area labels: Center in polygon, sized appropriately
- Prioritize: Major features get labels first, minor features labeled if space allows
Zoom Level Strategy
Zoom 0-4 (World to Continent):
- - Major country boundaries
- Ocean and sea labels
- Capital cities only
Zoom 5-8 (Country to State):
- - State/province boundaries
- Major cities
- Major highways
- Large water bodies
Zoom 9-11 (Metro Area):
- - City boundaries
- Neighborhoods
- All highways and major roads
- Parks and landmarks
Zoom 12-15 (Neighborhood):
- - All streets
- Building footprints
- POIs (restaurants, shops)
- Street names
Note: Mapbox's hosted Streets style defaults to showing most POIs around zoom 14. For custom styles, start POIs at zoom 12 — this is the neighborhood scale where density is manageable and users are browsing. Zoom 14 is late; zoom 10 (metro-area scale) is far too early and creates severe icon clutter.
Zoom 16-22 (Street Level):
- - All detail
- House numbers
- Parking lots
- Fine-grained POIs
Mapbox-Specific Implementation Guidance
Style Layer Best Practices
Layer Ordering (bottom to top):
- 1. Background (solid color or pattern)
- Landuse (parks, residential, commercial)
- Water bodies (oceans, lakes, rivers)
- Terrain/hillshade (if using elevation)
- Buildings (3D or 2D footprints)
- Roads (highways → local streets)
- Borders (country, state lines)
- Labels (place names, street names)
- POI symbols
- User-generated content (routes, markers)
Common mistake: Developers often put their app's route line or active markers below POI symbols, reasoning that "POIs must stay visible." This is backwards — user-generated content (your route, selected location, user position) is the most important layer and must render above everything, including POIs. A route line that covers a POI icon is acceptable; a route obscured by POI icons is not.
Map Context Considerations
Know Your Audience:
- - General public: Simplify, use familiar patterns (Google/Apple style)
- Technical users: Include more detail, technical layers, data precision
- Domain experts: Show specialized data, use domain-specific symbology
Platform Considerations:
- - Mobile: Larger touch targets (44x44px minimum), simpler designs, readable at arm's length
- Desktop: Can include more detail, hover interactions, complex overlays
- Print: Higher contrast, larger text, consider CMYK color space
- Outdoor/Bright: Higher contrast, avoid subtle grays
Use Case Optimization:
- - Navigation: Emphasize roads, clear hierarchy, route visibility
- Data visualization: Muted base map, let data stand out
- Storytelling: Guide viewer attention, establish mood with colors
- Location selection: Show POIs clearly, provide context
- Analysis: Include relevant layers, maintain clarity at different zooms
Reference Files
For detailed guidance on specific topics, load these references as needed:
- -
references/scenarios.md — Common scenario guidance (Restaurant Finder, Real Estate, Data Visualization, Navigation) - INLINECODE4 — Performance optimization, testing checklist, and common mistakes to avoid
When to Use This Skill
Invoke this skill when:
- - Designing a new map style
- Choosing colors for map elements
- Making decisions about visual hierarchy
- Optimizing for specific use cases
- Troubleshooting visibility issues
- Ensuring accessibility
- Creating themed maps (dark mode, vintage, etc.)
技能名称:mapbox-cartography
详细描述:
Mapbox 制图技能
本技能提供专业的制图知识,帮助您使用 Mapbox 设计有效、美观且功能完善的地图。
核心制图原则
视觉层级
地图必须引导观看者的注意力聚焦于最重要的内容:
- - 最重要:兴趣点、用户位置、路线高亮
- 次要:主要道路、城市标签、地标
- 第三级:次要街道、行政边界
- 背景:水域、土地利用、地形
实现方法:
- - 使用大小、颜色强度和对比度建立层级
- 主要要素:高对比度、较大符号、醒目颜色
- 背景要素:低对比度、柔和颜色、较小文字
地图色彩理论
色彩和谐:
- - 类似色:使用色轮上相邻的颜色(蓝-绿-青)实现协调设计
- 互补色:使用相对的颜色(蓝/橙、红/绿)实现高对比度强调
- 单色系:单一色相搭配不同饱和度/明度,实现优雅简约的设计
色彩心理学:
- - 蓝色:水域、信任、冷静、专业(水域默认色)
- 绿色:公园、自然、生长、环保(植被、公园)
- 红/橙色:紧急、重要、餐饮(警报、餐厅)
- 黄色:谨慎、高亮、注意(警告、选中项)
- 灰色:中性、背景、道路(基础设施)
可访问性:
- - 确保文字对比度达到 4.5:1(WCAG AA 标准)
- 不要仅依赖颜色传达信息
- 使用色盲模拟器测试设计
- 避免在关键区分中使用红/绿组合
调色板模板:
浅色主题(日间/专业):
json
{
background: #f5f5f5,
water: #a0c8f0,
parks: #d4e7c5,
roads: #ffffff,
buildings: #e0e0e0,
text: #333333
}
深色主题(夜间模式):
json
{
background: #1a1a1a,
water: #0d47a1,
parks: #2e7d32,
roads: #3a3a3a,
buildings: #2d2d2d,
text: #ffffff
}
深色主题的道路颜色规则: 道路必须使用中性深灰色(#3a3a3a),与背景明显区分但不上色。切勿使用琥珀色、蓝色或其他色相为道路着色——将颜色保留给应用数据图层(路线、标记)。着色的基础道路和着色的数据图层会在视觉上相互竞争。融入背景的本地道路(#1a1a1a 背景上的 #1e1e1e)会产生“浮动标签”问题,即街道名称显示时下方没有可见的道路。
高对比度(可访问性):
json
{
background: #000000,
water: #0066ff,
parks: #00ff00,
roads: #ffffff,
buildings: #808080,
text: #ffffff
}
复古/怀旧:
json
{
background: #f4e8d0,
water: #b8d4d4,
parks: #c8d4a4,
roads: #d4c4a8,
buildings: #e4d4c4,
text: #4a3828
}
地图比例尺下的排版
字体选择:
- - 无衬线字体(Roboto、Open Sans):现代、清晰,小尺寸下可读性高——用于标签
- 衬线字体(Noto Serif):传统、正式——谨慎用于标题或历史地图
- 等宽字体:技术数据、坐标
文字大小:
地点标签(城市、兴趣点):11-14px
街道标签:9-11px
要素标签(公园):10-12px
地图标题:16-20px
归属信息:8-9px
标签放置:
- - 点标签:居中或轻微偏移(避免与符号重叠)
- 线标签:沿曲线排列,长要素重复显示
- 区域标签:多边形内居中,大小适当
- 优先级:主要要素优先获得标签,次要要素在空间允许时标注
缩放级别策略
缩放级别 0-4(世界到大陆):
缩放级别 5-8(国家到州):
缩放级别 9-11(都市区):
缩放级别 12-15(社区):
注意: Mapbox 托管的 Streets 样式默认在缩放级别 14 左右显示大多数兴趣点。对于自定义样式,建议从缩放级别 12 开始显示兴趣点——这是社区尺度,密度可控且用户正在浏览。缩放级别 14 偏晚;缩放级别 10(都市区尺度)则过早,会造成严重的图标混乱。
缩放级别 16-22(街道级别):
Mapbox 特定实现指南
样式图层最佳实践
图层顺序(从下到上):
- 1. 背景(纯色或图案)
- 土地利用(公园、住宅、商业)
- 水域(海洋、湖泊、河流)
- 地形/山体阴影(如果使用高程)
- 建筑(3D 或 2D 轮廓)
- 道路(高速公路 → 本地街道)
- 边界(国家、州界线)
- 标签(地名、街道名)
- 兴趣点符号
- 用户生成内容(路线、标记)
常见错误: 开发者常将应用的路线线或活动标记放在兴趣点符号下方,理由是“兴趣点必须保持可见”。这是错误的——用户生成内容(您的路线、选定位置、用户位置)是最重要的图层,必须渲染在所有内容之上,包括兴趣点。路线线覆盖兴趣点图标是可接受的;但路线被兴趣点图标遮挡则不可接受。
地图上下文考虑
了解您的受众:
- - 普通公众:简化,使用熟悉模式(Google/Apple 风格)
- 技术用户:包含更多细节、技术图层、数据精度
- 领域专家:显示专业数据,使用领域特定符号
平台考虑:
- - 移动端:更大的触摸目标(最小 44x44px),更简单的设计,在手臂距离内可读
- 桌面端:可包含更多细节、悬停交互、复杂叠加层
- 打印:更高对比度、更大文字、考虑 CMYK 色彩空间
- 户外/明亮环境:更高对比度,避免微妙灰色
用例优化:
- - 导航:强调道路,清晰层级,路线可见性
- 数据可视化:柔和底图,让数据突出
- 故事讲述:引导观看者注意力,用色彩营造氛围
- 位置选择:清晰显示兴趣点,提供上下文
- 分析:包含相关图层,在不同缩放级别保持清晰
参考文件
如需特定主题的详细指导,可根据需要加载以下参考:
- - references/scenarios.md — 常见场景指导(餐厅查找器、房地产、数据可视化、导航)
- references/performance-testing.md — 性能优化、测试检查清单及需避免的常见错误
何时使用本技能
在以下情况下调用本技能:
- - 设计新地图样式时
- 为地图元素选择颜色时
- 做出视觉层级决策时
- 针对特定用例优化时
- 排查可见性问题时
- 确保可访问性时
- 创建主题地图(深色模式、复古等)时