Minimap
Minimap provides a UI that allows users to confirm a physical location on a map, reducing delivery errors in both shipping and local dispatching contexts.
This page includes reference documentation for the MapboxAddressMinimap class, functions, and types in the Mapbox Search JS Web framework.
Class
MapboxAddressMinimap
MapboxAddressMinimap is a class that displays a marker on a map for confirmation purposes.
Instantiating it produces a DOM element that you append into any container;
set the feature property to display a marker for that location.
Optionally, this marker is editable. When editable, the marker can be moved around the map and the updated location is sent back to the Mapbox Contribute workflow.
The goal of MapboxAddressMinimap is to reduce delivery or geolocation error in shipping and
local dispatching contexts.
MapboxAddressMinimap expands to fill its container, and is hidden unless
MapboxAddressMinimap#feature is truthy. Setting MapboxAddressMinimap#feature
to null hides the component.
To use this class, you must have a Mapbox access token.
Set the token directly on the instance via accessToken, set it globally via
config.accessToken, or — when used inside a
confirmAddress() call — let the
confirmation dialog pass its token through automatically.
Example
const minimap = new MapboxAddressMinimap();
minimap.accessToken = 'YOUR_MAPBOX_ACCESS_TOKEN';
containerElement.appendChild(minimap);
minimap.feature = {
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [-122.4194, 37.7749]
},
properties: {}
};
Instance Members
Markers
Input data
Appearance
Methods
Options and Type Definitions
Anchor
Valid strings for setting markerAnchor on MapboxAddressMinimap
("center" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top" | "bottom" | "left" | "right")