Map(地图(Map))¶
The Map widget displays an object set or object data as a configurable, interactive, geospatial visualization. This widget shares many core capabilities with the Map application. For more details on layer configuration and interacting with complex geospatial data, see the Map documentation.
Map visualizations are comprised of three types of layers:
- Base map: Also called a base layer, this layer provides the background map imagery.
- Object layers: Represent object data as points or shapes on top of the base layer.
- Overlay layers: Preconfigured views of geospatial datasets that can be reused across maps.
The Map widget renders using MapboxGL ↗ and requires WebGL. It is optimized for desktop browsers and does not support mobile environments. For mobile or non-WebGL environments, use the Map [Legacy] widget. See the Map [Legacy] vs. Map comparison for guidance on choosing between widgets.
Below are some examples of maps with various layer configurations:

Layers¶
Users can configure the map object layers using two different options:
-
Local configuration (recommended): build and modify the contents and style of the map within the Workshop widget editor
-
Import map template: select an existing map template resource to use in your module, and map variables to the corresponding input parameters.
Local configuration¶
In the widget editor, select Add object layer to add a new layer to the map. Then, open the newly created layer, and create a new object set variable or reuse an existing one under Input object set. Once added, the new object layer will populate on the map.
With local configuration, layer settings can be completely controlled from the widget editor:
- Input
- Label: Rename the layer display title by editing this text field.
- Selected objects: Specify an object set variable that represents the collection of selected objects in a layer in the Map widget. This variable is bidirectional and can either be used to update the layer's selected objects, or it can respond to and adopt object sets that a user selects from the map.
- Layer visibility: Control whether the contents of the layer are visible or hidden in the map. This setting can be configured as a static value or a boolean variable.
- Lock layer: Toggle whether or not the layer is locked. Objects in locked layers cannot be selected by users.
- Style
- From the Style section, users can configure the default color, opacity, and label/tooltip settings for a layer. For more information about these options, see the layer style section from the Map application documentation.
- Geometry
- Under the Geometry section, a user can edit the styling for a specific geometry displayed on the map. Like in the Map application, geometries are different ways of representing the layer's objects.
- Geometries can be added by selecting Add geometry. Reorder geometries by dragging them from the left side of their labels, and delete them by selecting the trash icon when hovering over a geometry.
- Loading methods [beta] can also be configured under the Geometry section for supported geometry types.
- If an object type includes a Geoshape property and you configure it in a Map layer geometry, the Map widget automatically loads and renders it. Because Geoshape values can be large, they may impact loading performance. Learn more in Unsupported object property types.
- Legend visibility
- An object layer and its geometries are visible by default in the legend panel of the map. Under the Legend visibility section, you can toggle the visibility of the entire layer or individual geometries.
In addition to object layers, the local configuration editor also allows users to add overlay layers. These overlays are created in the map layer editor.
The base layer picker controls the default background map imagery. When the Show base layer picker toggle is enabled, users can edit the base map from the Map widget interface.

Import map template¶
For information about using an existing resource to configure a Map widget, see how to embed a map template in a Workshop module.
Interactions¶
- Draw options: Configure which shape drawing tools will be available in the toolbar.
- Drawn shape colors: Configure the color of drawn shapes on the map.
- Drawn shape opacity: Configure the opacity of drawn shapes on the map.
- Shape output type: Control whether the GeoJSON string output of the drawn shapes variable and selected shape variable are represented as a GeoJSON feature or geometry collection.
- Drawn shapes: A bidirectional string variable that reflects the shapes drawn within the map interface as a GeoJSON string.
- On drawn shape: Configure Workshop events to trigger when a shape is drawn in the map.
- Enable single draw mode: Limit users to only draw one shape at a time on the map interface, automatically removing the previous shape when a new one is drawn.
- Clear shapes after operation: Control whether drawn shapes are cleared after an operation that uses them (selecting intersecting objects, searching for objects, or searching for tracks).
- Enable splitting on antimeridian: Control whether shapes that are drawn across the antimeridian will be split into separate polygons.
- Enable shaped-based selection: Enable a tool to select objects on the map that intersect a drawn shape.
- Enable geospatial object search: Enable a tool to search the Ontology for objects that intersect a drawn shape.
- Enable shape-based track tools: Enable tools that allow users to search the Ontology for tracks that intersect a drawn shape and filter map breadcrumbs by that shape.
- Enable shape editing tools: Enable a tool to modify a drawn shape.
- Enable measurements: Allow users to view the measurements of their drawn shapes. Units are based on map settings if configured, or default to organization settings.
- Enable polygon perimeter: Show the length of each segment or the total perimeter length along a drawn polygon's edges.
- Enable polygon area: Show the polygon's area in the center of the drawn polygon.
- Enable line measurements: Show either individual segment lengths or the total length of a drawn line
- Selected shapes: A bidirectional string variable that reflects the shapes selected on the map interface as a GeoJSON string.
Time configuration¶
- Enable timeline: Display the timeline open button at the bottom of the map interface.
- Allow user to change selected time: Enable user control of the selected time cursor in the timeline panel.
- Enable user facing live mode toggle: Enable the View latest option in the timeline panel.
- Open timeline by default: Open the timeline by default without selecting the timeline button.
- Selected time: Control the selected time using a Workshop variable of type
TimestamporDate. - Time window: Control the time window using two Workshop variables of type
TimestamporDate. - Time zone: Change the time zone used on the timeline panel to be
LocalorUTC. - Time format: Additional configuration for the
Localtime zone to be in the time format of12-hour,24-hour, orLocal. - Playback state: Use a boolean variable to control whether the timeline is playing or paused.
- Playback position: Output the current playback time (in milliseconds) as a numeric variable.
- Auto pause at: Use a timestamp array variable to automatically pause playback at specific times.
Interface¶
- Legend: Display the legend panel in the map interface.
- Collapse legend panel: Collapse the legend panel by default when the map is first opened.
- Panel size: Choose whether the legend panel should be displayed in full size or in a compact manner.
- Enable search around: Enable search arounds using the toolbar and context menu.
- Enable advanced selection tools: Enable selection tools in the toolbar and context menu.
- Show selection panel: Display the list of currently selected objects or a selected object's details in a panel in the Map widget interface.
- Viewport auto zoom: Control the zooming behavior of the Map widget.
- Object set: Centers the map on the content of the given object set.
- All objects: Centers the map on all objects added to the Map widget
- Only update if outside viewport: Restrict auto zooming behavior to instances where the target objects are completely outside of the current viewport
- Viewport bounds: This setting is a bidirectional string variable where the GeoJSON value represents the current viewing window of the map.
- Viewport follow object set: Provide an object set that the map window will keep centered as the objects' locations change with the selected time.
- Enable transition to full Map application: Allow users to open the Map application from the widget, using their current state.
中文翻译¶
地图(Map)¶
地图(Map) 组件(Widget)可将对象集(Object Set)或对象数据展示为可配置的交互式地理空间可视化效果。该组件与Map应用共享多项核心能力。关于图层配置以及复杂地理空间数据交互的更多详情,请参阅Map文档。
地图可视化包含三类图层(Layer):
- 底图(Base Map): 也称为基础图层(Base Layer),提供地图背景影像。
- 对象图层(Object Layer): 将对象数据以点或形状的形式渲染在基础图层之上。
- 叠加图层(Overlay Layer): 是地理空间数据集的预配置视图,可在不同地图间复用。
地图组件基于MapboxGL ↗渲染,需要WebGL支持。它针对桌面浏览器做了优化,不支持移动端环境。如果需要在移动端或不支持WebGL的环境中使用,请选用[Map Legacy]组件。如需了解如何在两个组件中选择,请参阅[Map Legacy] 与 Map 的对比说明。
以下是使用不同图层配置的地图示例:

图层¶
用户可通过两种方式配置地图对象图层:
- 本地配置(推荐): 在Workshop组件编辑器中构建并修改地图的内容与样式
- 导入地图模板(Map Template): 选择现有地图模板(Map Template)资源在模块中使用,并将变量映射到对应的输入参数。
本地配置¶
在组件编辑器中选择添加对象图层即可为地图新增一个图层。随后打开新创建的图层,在输入对象集下新建一个对象集变量,或复用已有的对象集变量。添加完成后,新的对象图层就会显示在地图上。
使用本地配置时,所有图层设置都可以在组件编辑器中完全控制:
- 输入
- 标签: 编辑该文本框即可重命名图层的展示标题。
- 选中对象: 指定一个对象集变量,用于表示地图组件中某图层内已选中的对象集合。该变量是双向的,既可以用来更新图层的选中对象,也可以响应用户在地图上选择的对象集并同步更新。
- 图层可见性: 控制图层内容在地图上显示或隐藏。该设置可配置为静态值,也可绑定布尔类型变量。
- 锁定图层: 切换图层是否锁定。锁定图层中的对象无法被用户选中。
- 样式
- 在样式板块,用户可配置图层的默认颜色、透明度、标签/提示框设置。如需了解这些选项的更多信息,请参阅Map应用文档中的图层样式章节。
- 几何要素(Geometry)
- 在几何要素板块,用户可以编辑地图上展示的特定几何要素的样式。和Map应用中一样,几何要素是表示图层中对象的不同形式。
- 点击添加几何要素即可新增几何要素。拖动几何要素标签左侧的区域可以调整顺序,悬停时点击垃圾桶图标即可删除对应几何要素。
- 对于支持的几何要素类型,还可以在几何要素板块配置加载方式 [beta]。
- 如果某个对象类型包含地理形状(Geoshape)属性,且你在地图图层几何要素中对其进行了配置,地图组件会自动加载并渲染该属性。由于地理形状值可能体积较大,可能会影响加载性能。详情请参阅不支持的对象属性类型。
- 图例(Legend)可见性
- 对象图层及其几何要素默认会在地图的图例面板中展示。在图例可见性板块,你可以切换整个图层或单个几何要素的可见性。
除了对象图层之外,本地配置编辑器还支持用户添加叠加图层。这些叠加图层是在地图图层编辑器中创建的。
底图选择器用于控制默认的背景地图影像。开启显示底图选择器开关后,用户可以在地图组件界面中修改底图。

导入地图模板¶
如需了解如何使用现有资源配置地图组件,请参阅如何在Workshop模块中嵌入地图模板。
交互¶
- 绘制选项: 配置工具栏中可用的形状绘制工具。
- 绘制形状颜色: 配置地图上已绘制形状的颜色。
- 绘制形状透明度: 配置地图上已绘制形状的透明度。
- 形状输出类型: 控制绘制形状变量和选中形状变量的GeoJSON字符串输出是表示为GeoJSON要素还是几何集合。
- 已绘制形状: 双向字符串变量,以GeoJSON字符串形式反映在地图界面中绘制的形状。
- 绘制形状触发事件: 配置在地图中绘制形状时要触发的Workshop事件。
- 启用单次绘制模式: 限制用户每次在地图界面只能绘制一个形状,绘制新形状时会自动移除之前的形状。
- 操作后清除形状: 控制在使用绘制形状执行操作(选择相交对象、搜索对象、搜索轨迹)后是否清除已绘制的形状。
- 启用反子午线拆分: 控制跨越反子午线绘制的形状是否会被拆分为多个独立多边形。
- 启用基于形状的选择: 开启工具来选择地图上与绘制形状相交的对象。
- 启用地理空间对象搜索: 开启工具来搜索本体(Ontology)中与绘制形状相交的对象。
- 启用基于形状的轨迹工具: 开启相关工具,支持用户搜索本体中与绘制形状相交的轨迹,并通过该形状过滤地图面包屑。
- 启用形状编辑工具: 开启工具来修改已绘制的形状。
- 启用测量功能: 允许用户查看已绘制形状的测量值。如果已配置地图设置,单位将基于该设置,否则默认采用组织设置。
- 启用多边形周长测量: 展示绘制的多边形每条边的段长或总周长。
- 启用多边形面积测量: 在绘制的多边形中心展示其面积。
- 启用线段测量: 展示绘制的线段每一段的长度或总长度。
- 选中形状: 双向字符串变量,以GeoJSON字符串形式反映在地图界面中选中的形状。
时间配置¶
- 启用时间轴: 在地图界面底部显示时间轴打开按钮。
- 允许用户修改选中时间: 允许用户控制时间轴面板中的选中时间光标。
- 启用面向用户的实时模式开关: 在时间轴面板中启用查看最新数据选项。
- 默认打开时间轴: 无需点击时间轴按钮,默认直接打开时间轴。
- 选中时间: 使用
Timestamp或Date类型的Workshop变量控制选中的时间。 - 时间窗口: 使用两个
Timestamp或Date类型的Workshop变量控制时间窗口。 - 时区: 将时间轴面板使用的时区修改为
Local或UTC。 - 时间格式: 针对本地时区的额外配置,可选择
12小时制、24小时制或本地默认格式。 - 播放状态: 使用布尔变量控制时间轴是播放还是暂停状态。
- 播放位置: 将当前播放时间(单位为毫秒)作为数值变量输出。
- 自动暂停时间点: 使用时间戳数组变量,让播放到指定时间点时自动暂停。
界面¶
- 图例: 在地图界面中展示图例面板。
- 默认折叠图例面板: 首次打开地图时默认折叠图例面板。
- 面板尺寸: 选择图例面板是全尺寸展示还是紧凑展示。
- 启用周边搜索(Search Arounds): 支持通过工具栏和上下文菜单使用周边搜索功能。
- 启用高级选择工具: 在工具栏和上下文菜单中启用选择工具。
- 显示选择面板: 在地图组件界面的面板中展示当前选中对象列表,或单个选中对象的详情。
- 视口(Viewport)自动缩放: 控制地图组件的缩放行为。
- 指定对象集: 将地图居中对齐到给定对象集的内容。
- 所有对象: 将地图居中对齐到添加到地图组件的所有对象。
- 仅在视口外时更新: 仅当目标对象完全不在当前视口范围内时才触发自动缩放行为。
- 视口边界: 该设置为双向字符串变量,其GeoJSON值表示地图当前的可视窗口范围。
- 视口跟随对象集: 指定一个对象集,当对象的位置随选中时间变化时,地图窗口将始终保持该对象集居中。
- 允许跳转至完整Map应用: 允许用户从组件中打开Map应用,并保留当前使用状态。