← 提示词库 Meta/muse-agent/skills/artifacts/references/maps.md 原文 md
🌐 中英双语对照

description: Choose and verify Meta maps, resolve places, present geographic data, and build navigation links.
builders: web, file

Maps and places / 地图与地点

Read this when an artifact shows places, maps, routes, directions, or geographic
data. Use the bundled scripts described in Map helpers for URL
generation and map setup.

当产物要展示地点、地图、路线、导航或地理数据时阅读本文。URL 生成与地图设置请使用 Map helpers 中描述的内置脚本。

Choose the rendering approach / 选择渲染方式

Meta's map services render every map. Use the bundled Meta control for interactive
maps and Meta's static endpoint for map images. Do not substitute another renderer
or tile source, including vendored libraries or downloaded tile pyramids. Satellite
and aerial imagery are unavailable. Preserve the required attribution below.

所有地图都由 Meta 的地图服务渲染。交互式地图使用内置的 Meta 控件,地图图像使用 Meta 的静态端点。不得替换为其他渲染器或瓦片源,包括内置的第三方库或下载的瓦片金字塔。卫星与航空影像不可用。须保留下文要求的署名信息。

Surface and data What to show
Live web page with trusted coordinates An interactive vector map. If the control is unavailable or cannot render, show the place list without a map.
Fixed-layout export or headless rasterization with trusted coordinates A stored static map image with the place list beside it.
Places without trusted coordinates A place list with maps search links, without a map.
承载面与数据 应展示的内容
带可信坐标的实时网页 交互式矢量地图。若控件不可用或无法渲染,则只展示地点列表、不放地图。
带可信坐标的固定版式导出或无头栅格化 一张存储的静态地图图像,旁边附地点列表。
没有可信坐标的地点 带地图搜索链接的地点列表,不放地图。

A live page uses a vector map or no map; a static image is not its fallback.
Missing coordinates do not justify choosing a different renderer or inventing
location data. Static maps take [lat, lng]; GeoJSON and interactive map coordinates
use [lng, lat]. Keep latitude and longitude named and convert at the boundary.

实时页面要么用矢量地图、要么不放地图;静态图像不是它的回退选项。缺少坐标不构成更换渲染器或编造位置数据的理由。静态地图使用 [lat, lng];GeoJSON 与交互式地图坐标使用 [lng, lat]。保持经纬度命名清晰,并在边界处做转换。

The second row is different on a confidential VM; see
Exports on a confidential VM.

在机密虚拟机上,第二行有所不同;参见 Exports on a confidential VM。

For geographic data, choose a map when location carries the meaning, such as
adjacency, distance, or clustering. Use a chart for comparisons and rankings; a
page can include both. See Data maps for supported encodings.

对地理数据而言,当位置本身承载含义(如相邻、距离或聚集)时选用地图。比较与排名用图表;一页可以两者兼有。支持的编码方式见 Data maps。

Resolve places / 解析地点

Resolve places through Meta's places graph when it is reachable. Use web search
for candidate names and editorial context; it does not replace place resolution.
For a resolved venue, take its facts and media from the graph record, including on
later edits. Do not fill missing fields from review sites, web images, or stock
photos.

在可达时通过 Meta 的地点图谱解析地点。网络搜索用于候选名称与编辑性背景;它不能替代地点解析。对已解析的场所,其事实与媒体一律取自图谱记录,后续编辑亦然。不要用点评网站、网络图片或图库照片填补缺失字段。

Run the bundled local-search and places details CLIs through exec:

通过 exec 运行内置的 local-search 与 places details CLI:

Keep lookup outcomes distinct:

区分不同的查询结果:

Evidence Place handling
Graph resolves the place Use its coordinates and record. A permanently closed place is not plotted.
Graph rejects a candidate you found Do not name or plot that candidate.
User named the place, but resolution fails Retain it. Plot user-supplied coordinates if present; otherwise list it with a search link.
Graph is unreachable Use the information already held: plot user-supplied coordinates; list names or addresses without coordinates with search links.
证据 地点处理方式
图谱解析出该地点 使用其坐标与记录。永久歇业的地点不予绘制。
图谱否决了你找到的候选 不得提名或绘制该候选。
用户点名了该地点,但解析失败 保留它。若有用户提供的坐标则绘制;否则带搜索链接列入清单。
图谱不可达 使用已掌握的信息:绘制用户提供的坐标;没有坐标的名称或地址配搜索链接列入清单。

An unreachable lookup is not a rejection. Do not geocode a place name, approximate
from a locality, or invent coordinates to fill a lookup gap. Never drop a
user-named place because a lookup missed. These place-resolution rules do not
replace the source data for geographic datasets and overlays.

查询不可达不等于被否决。不要对地名做地理编码、不要从街区近似推算、也不要编造坐标来填补查询空缺。绝不要因为查询未命中就丢弃用户点名的地点。这些地点解析规则不取代地理数据集与叠加层的源数据。

【评论】把"查不到"与"不存在/被否决"区分开、并禁止用地理编码自行补坐标,是防止模型编造位置数据的典型约束。

Save the details payload under the task's project_dir: .src/research/places.json
for file artifacts or client/src/research/places.json for web artifacts. Reuse it
on later edits or fetch details again. It is build-time input: never import the
payload into the page. Inline only the fields used and store images locally.

把详情载荷保存在任务的 project_dir 下:文件产物用 .src/research/places.json,网页产物用 client/src/research/places.json。后续编辑时复用它,或重新获取详情。它是构建期输入:绝不要把载荷导入页面。只内联用到的字段,图像在本地存储。

Present place data / 呈现地点数据

Store structured location facts using PlaceRef from the helper reference and
derive links from them. Keep display labels separate from source coordinates. Store the street
line in address, the city in locality, and the state in region; do not repeat
address parts. Preserve coordinate provenance where the artifact depends on it.
Never invent addresses, neighborhoods, coordinates, or drive times.

使用助手参考中的 PlaceRef 存储结构化位置事实,并从它们派生链接。展示标签与源坐标分开保存。街道行存入 address,城市存入 locality,州存入 region;不要重复地址组成部分。当产物依赖坐标来源时保留其溯源信息。绝不编造地址、街区、坐标或车程时间。

Static maps / 静态地图

Use the static URL script, which supplies the
required caller and attribution parameters. Fetch the image at build time and store it in
.src/media/ for file artifacts. Where web asset storage is needed, use
client/src/assets/ or ctx.blobs. Never ship the static endpoint as an image src.

使用 static URL script,它会提供必需的 caller 与署名参数。在构建期获取图像,文件产物存入 .src/media/。需要网页资产存储时,用 client/src/assets/ 或 ctx.blobs。绝不把静态端点直接当作图像 src 发布。

Exports on a confidential VM / 机密虚拟机上的导出

A static map request carries its markers in the URL, so asking for the image
tells the service where the reader's places are. On a confidential VM that is
the one recipient the VM exists to keep this data from, and an attested
transport would not change it, so do not call the static endpoint there at all.

静态地图请求把标记点带在 URL 里,因此请求图像就等于告诉服务读者的地点在哪里。在机密虚拟机上,地图服务恰恰是这台虚拟机要防止其接触该数据的那一方,即便走可证明的传输通道也不会改变这一点,因此在机密虚拟机上完全不要调用静态端点。

【评论】这是一条由威胁模型直接推出的约束:请求 URL 本身就是泄露通道,目标服务正是数据要隔离的对象,故整条调用路径被禁止而非加密了事。

Draw the export's map in the guest instead, from coordinates or GeoJSON the
build already holds, with the same deterministic plotting the charts use. Fetch
no basemap, no tiles and no rendered map image, and do not substitute a
third-party renderer or tile service to make up the difference. The result is
plainer than a Meta basemap; that is the trade. Published boundary geometry is
still available, because that request carries no reader location of its own.

改为在 guest 内绘制导出地图,使用构建已持有的坐标或 GeoJSON,采用与图表相同的确定性绘制。不获取底图、瓦片或任何渲染好的地图图像,也不要用第三方渲染器或瓦片服务来弥补。结果会比 Meta 底图朴素;这就是代价。已发布的边界几何仍可使用,因为该请求本身不携带读者位置。

The rest of this file still holds. Do not invent coordinates to fill the
drawing, keep the place list beside it, and where there are no trusted
coordinates the third row still applies: a place list and no map.

本文件其余规则仍然有效。不要为绘图编造坐标,旁边保留地点列表;没有可信坐标时第三行仍然适用:只有地点列表、不放地图。

Interactive maps / 交互式地图

Use /opt/hatch/skills/artifacts/map-runtime/dist/hatch-maps.js and
hatch-maps.css. Confirm both exist, copy them into the artifact's assets, and
reference the local copies. A build-VM path is not a served URL. Do not install
another renderer, load one from a public CDN, or import @meta/maps directly.
Give the map container a resolved height.

使用 /opt/hatch/skills/artifacts/map-runtime/dist/hatch-maps.js 与 hatch-maps.css。确认两者存在,复制进产物资产并引用本地副本。构建虚拟机路径不是可访问的 URL。不要安装其他渲染器、不要从公共 CDN 加载、也不要直接 import @meta/maps。给地图容器一个确定的(resolved)高度。

Use the mount helpers, which check capabilities
and route fatal errors to your onUnavailable callback. That callback shows
"Map unavailable" with a place list, or a table or chart of the values for a data
map. Boundary-data fetch failures use the same callback. Leave a map mounted
after non-fatal tile, sprite, or glyph errors.

使用 mount helpers,它们会检查能力并把致命错误路由到你的 onUnavailable 回调。该回调展示"Map unavailable"加地点列表,或为数据地图展示数值的表格/图表。边界数据获取失败也走同一回调。非致命的瓦片、sprite 或字形错误发生时,地图保持挂载。

Choose baseStyle by name: light (default), dark, or grayscale. The runtime
owns style URLs, caller identifiers, and viewer locale. Do not pass a style URL or
set locale or pv. Do not add custom headers to map-resource requests: the map
servers do not support the resulting CORS preflight.

按名称选择 baseStyle:light(默认)、dark 或 grayscale。样式 URL、caller 标识与查看者区域设置(locale)由运行时管理。不要传样式 URL,也不要设置 locale 或 pv。不要给地图资源请求添加自定义头:地图服务器不支持由此触发的 CORS 预检。

Keep overlays beneath basemap labels and the control's pin layers above overlays.
The runtime supplies these defaults. If authoring a symbol layer, keep icons while
thinning colliding labels with text-allow-overlap: false and text-optional: true;
place it last so its labels take priority over basemap labels.

叠加层保持在底图标注之下,控件的图钉层在叠加层之上。运行时提供这些默认值。若自行编写符号层,用 text-allow-overlap: false 与 text-optional: true 在保留图标的同时稀疏化冲突标注;把它放在最后,使其标注优先于底图标注。

For a map with a place list:

对带地点列表的地图:

Read the interactive helpers for these APIs.

这些 API 详见 interactive helpers。

Data maps / 数据地图

Use GeoJSON sources with layer specifications through overlays on the vector
map, built by the data overlay helpers. The
static tier supports only markers, circles, and paths; choose from those
capabilities for fixed-layout maps.

在矢量地图上通过 overlays 使用带图层规格的 GeoJSON 源,由 data overlay helpers 构建。静态层只支持标记、圆和路径;固定版式地图从这些能力中选择。

Encoding Layer type Data
Choropleth fill Rates or ratios for enumeration units, with a meaningful value across the represented area
Proportional or graduated symbols circle Counts or totals; scale symbol area with the value
Heatmap heatmap Density of many points
Dot density Small circle symbols One dot per item or per stated quantity
Category points circle with a match expression Unordered classes
Outlines and routes line Boundaries and paths
编码方式 图层类型 数据
分级统计图(Choropleth) fill 枚举单位的比率或比例,且该值在所表示的区域内有意义
比例符号或分级符号 circle 计数或总量;符号面积随数值缩放
热力图 heatmap 大量点的密度
点密度图 小型 circle 符号 每个项目一个点,或每个声明的数量一个点
类别点 带 match 表达式的 circle 无序类别
轮廓与路线 line 边界与路径

Do not shade raw counts as a choropleth or treat absence of a phenomenon as a low
value. Use point encodings for phenomena that exist only at specific locations.
Scale proportional symbols with r = k * sqrt(value) and show two or three
reference sizes in the legend. Graduated symbols may group values into classes.
A dot-density legend must say whether a dot represents one item or a quantity.

不要把原始计数画成分级统计图,也不要把现象缺席当作低数值。只存在于特定位置的现象用点编码。比例符号按 r = k * sqrt(value) 缩放,并在图例中展示两三个参考尺寸。分级符号可以把数值分组为等级。点密度图的图例必须说明一个点代表一个项目还是一个数量。

For choropleths, use the choropleth helper, which
fetches the published geometry, joins the data onto its features, and mounts the
result. Join countries on iso_2 or iso_3 and US states on postal_code or
iso_3166. Keep missing values as null, leave those regions unpainted, and
explain them in the legend.

分级统计图使用 choropleth helper,它会获取已发布的几何数据、把数据连接到要素上并挂载结果。国家按 iso_2 或 iso_3 连接,美国州按 postal_code 或 iso_3166 连接。缺失值保持 null,这些区域不上色,并在图例中说明。

Use a grayscale basemap under data overlays. Choose a sequential palette for
ordered values, a diverging palette around a meaningful midpoint, or a categorical
palette for unordered classes. Derive hues from the page's palette while preserving
legible distinctions; choose a nearby hue if the page accent cannot support the
required range. Do not use rainbow ramps. See Charts for shared
encoding guidance.

数据叠加层下使用 grayscale 底图。有序数值选用顺序(sequential)调色板,围绕有意义中点的数据选用发散(diverging)调色板,无序类别选用分类(categorical)调色板。色相从页面调色板派生,同时保持可辨识的差异;若页面强调色撑不起所需范围,选邻近色相。不要使用彩虹色带。共享编码指南见 Charts。

Give overlays that carry values a tooltip showing the relevant values, and say
a region has no data in the artifact's own language rather than leaving the
helper's English default. A data map that cannot render shows its values as a
table or chart, not a place list.

承载数值的叠加层要配置 tooltip 展示相关数值;"该区域无数据"要用产物自身语言表述,而不是保留助手的英文默认值。无法渲染的数据地图把数值展示为表格或图表,而不是地点列表。

Language and political view / 语言与政治视角

Political view controls disputed borders. Do not infer it from language or choose
a default.

政治视角(political view)控制争议边界的画法。不要从语言推断它,也不要擅自选默认值。

Rendering Parameters
Interactive Leave locale and pv unset so the runtime resolves them per reader.
Static Pass language (IETF tag) and region (political-view ccTLD) unchanged only when supplied by the task or context; omit missing values.
渲染方式 参数
交互式 保持 locale 与 pv 不设置,由运行时按读者解析。
静态 仅当任务或上下文提供了 language(IETF 标签)与 region(政治视角 ccTLD)时原样传递;缺失的值直接省略。

【评论】地图的政治视角是产品层面的合规参数:同一地理数据在不同视角下争议边界画法不同,因此被要求显式提供而不是让模型推断。

Navigation links / 导航链接

Use Google Maps only for the outbound search and directions handoff, with neutral
labels such as "Open in maps" or "Directions". Use the
navigation builders.

Google Maps 只用于向外的搜索与路线交接,标签保持中性,如"Open in maps"或"Directions"。使用 navigation builders。

Attribution / 署名

Leave the interactive control's attribution visible and intact. Do not hide,
cover, shrink, or replace it.

交互式控件的署名保持可见且完整。不要隐藏、遮盖、缩小或替换它。

For static maps, keep show_attribution=1 and leave the baked-in credit uncropped.
Render this notices link beneath the image:

静态地图保持 show_attribution=1,烧录署名不裁切。在图像下方渲染这个声明链接:

<a href="https://www.facebook.com/maps/attribution_terms"
   target="_blank" rel="noopener">© OpenStreetMap contributors, Map Data Legal Notices</a>

A map drawn in the guest has no baked-in credit to keep, so render that same
notices link beneath it whenever it draws published boundary geometry. A drawing
made only from the build's own coordinates credits nothing.

在 guest 内绘制的地图没有烧录署名可保留,因此只要它绘制了已发布的边界几何,就在其下方渲染同一声明链接。仅用构建自有坐标绘制的图形无需任何署名。

Verify / 校验