19 chapters · 62 min
Skills
Chapter 14 of 19
Common patterns for building store locators, restaurant finders, and location-based search applications with Mapbox.
2 minutes · 418 words · 12 sections
Comprehensive patterns for building store locators, restaurant finders, and location-based search applications with Mapbox GL JS. Covers marker display, filtering, distance calculation, interactive lists, and directions integration.
Use this skill when building applications that:
Required:
Installation:
npm install mapbox-gl @turf/turfA typical store locator consists of:
mapboxgl.GeolocateControl — simpler than custom markers.GeoJSON format for locations:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-77.034084, 38.909671]
},
"properties": {
"id":
Key properties:
id - Unique identifier for each locationname - Display nameaddress - Full address for display and geocodingcoordinates - [longitude, latitude] formatcategory - For filtering (retail, restaurant, office, etc.)import mapboxgl from 'mapbox-gl';
import 'mapbox-gl/dist/mapbox-gl.css';
mapboxgl.accessToken = 'YOUR_MAPBOX_ACCESS_TOKEN';
// Store locations data
const stores = {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
Marker strategy by location count:
| Count | Strategy | Reason |
|---|---|---|
| Fewer than 100 | HTML Markers | Full DOM/CSS control; DOM node count is manageable |
| 100–1,000 | Symbol Layer (default) | Renders on the GPU via WebGL — one <canvas>, zero per-point DOM elements |
| More than 1,000 | Clustering | Reduces visual clutter at large scale |
HTML Markers create one DOM element per point. Beyond ~100 locations the browser spends too much time on layout/paint. Symbol layers bypass the DOM entirely — the GPU draws all points in a single WebGL draw call.
Symbol Layer implementation (best for 100–1,000 locations). For HTML Markers (fewer than 100) or Clustering (more than 1,000), see references/markers.md.
map.on('load', () => {
// Add store data as source
map.addSource('stores', {
type: 'geojson',
data: stores
});
function buildLocationList(stores) {
const listingContainer = document.
Load these references for additional patterns as needed:
| Reference | File | Contents |
|---|---|---|
| HTML Markers & Clustering | references/markers.md | HTML Markers (< 100 locations), Clustering (> 1000 locations) |
| Search & Filter | references/search-filter.md | Text search, category filter |
| Geolocation & Directions | references/geolocation-directions.md | User location, distance calculation, route directions |
| Styling & Layout | references/styling-layout.md | Full HTML/CSS layout, custom marker CSS |
| Performance & A11y | references/optimization-a11y.md | Debounced search, data management, error handling, accessibility |
| Variations & React | references/variations-react.md | Mobile-first, fullscreen, map-only, React implementation |
Install this repository
npx skills add mapbox/mapbox-agent-skills/plugin marketplace add mapbox/mapbox-agent-skillsSkills install per repository, not per chapter — the CLI has no documented per-skill form, so we do not print one.
Common patterns for building store locators, restaurant finders, and location-based search applications with Mapbox. Covers marker display, filtering, distance calculation, and interactive lists.
The verbatim description from this skill’s front matter — the string an agent matches on to decide whether to load it.
main, last pushed 7 August 2026.SKILL.md, not by matching a directory convention. One layout observed: skills/*/SKILL.md.h1 and no skipped levels:.claude-plugin/marketplace.json by Mapbox Plugin Marketplace, declaring 1 plugin. It is read for editorial metadata only — never as the skill index, which is always the repository tree./mapbox/mapbox-agent-skills.md.md8 files · 34 KB
Everything this skill ships beside its prose. All of it is set here, as subchapters of chapter 14.
Documentation the agent loads on demand, rather than up front.
Everything else published alongside the skill.