docs/docs/en/interface-builder/blocks/data-blocks/map.md
The Map block displays geographic data from a collection on a map. It is suitable for scenarios such as store locations, customer addresses, device distribution, route tracking, and area management.
The Map block supports AMap and Google Maps. It can render point, line, polygon, and circle fields, and can open record views or run block actions from map overlays.
The Map block is provided by the built-in @nocobase/plugin-map plugin. Enable the plugin before adding the block.
After enabling the plugin, go to "Plugin settings / Map manager" and configure the map provider:
Access key, plus securityJsCode or serviceHostApi keyIf the map cannot be loaded, check whether the key is valid, whether the domain whitelist includes the current access domain, and whether the browser can access the selected map provider.
Before adding a Map block, create at least one map field in the target collection. You can find these field types in the "Map-based geometry" group:
| Field type | Usage |
|---|---|
| Point | Marks a single location, such as a store, device, or customer address |
| Line | Represents a route or track |
| Polygon | Represents an area |
| Circle | Represents a radius around a center point |
When creating the field, choose the "Map type". This determines whether the field editor and the block use AMap or Google Maps.
In page configuration mode, click "Add block" and choose "Map" from "Data Blocks".
When creating the block, configure:
If the collection has no available map field, the "Map field" selector will be empty. Add a point, line, polygon, or circle field to the collection first.
Used to change the map field displayed by the block and the marker label field.
The marker field only applies to point fields. It is usually a text field such as name, address, or code.
Used to restrict the records displayed in the Map block.
For large datasets, configure a data scope or add filter actions to narrow the displayed records. The Map block loads all records that match the data scope without pagination.
For more details, see: Set Data Scope
Used to sort point records and connect them into a route.
This setting only takes effect when the map field is a point field.
Used to set the initial zoom level of the map.
The Map block supports adding actions at the top of the block, such as:
Clicking a map overlay triggers the record opening flow, which is usually used to open a popup, drawer, or another record view.
The Map block provides selection tools in the upper-left corner:
Selected records are synced to the block resource and can be used by later block actions.