Skip to content

← Embed builder

Embed documentation

Everything you need to put the MapJamaica map on your site — parameters, layers, events, and answers.

Getting started

  1. 1. Open the embed builder and tap the example closest to what you're making — single business, parish overview, live transit, address picker, or multi-stop tour.
  2. 2. Customize with the scenario panel (search your business, tick your routes, add your stops). The live preview is exactly what your visitors will see.
  3. 3. Copy the snippet in your format — iframe (works anywhere), Web Component, React, or Svelte — and paste it into your site.

Integration guides

iframe — works anywhere

  • Copy the iframe snippet from the builder and paste it into any HTML page, CMS block, WordPress/Wix/Shopify custom-HTML widget — no build step, no dependencies.
  • The snippet ships with loading="lazy" (no page-speed cost until scrolled into view) and allow="geolocation" so the in-map locate button can work if your user grants it.
  • Responsive recipe: wrap in a div with position:relative; padding-bottom:62% and give the iframe position:absolute; inset:0; width:100%; height:100%.

Web Component — attribute API + events

  • One script tag registers <mapjamaica-map>: <script src="https://mapjamaica.com/embed/v1.js" defer></script> (2.9 KB).
  • Attributes mirror the URL params: center, zoom, sel, mode, style-name, controls, layers, routes, markers, show-nearby, origin. Change an attribute and the map updates.
  • Listen for mapjamaica:ready, mapjamaica:select, mapjamaica:move, mapjamaica:picker:point as DOM CustomEvents on the element; call el.setCenter(lat, lng), el.setZoom(z), el.selectFeature(...), el.setLayers([...]) to drive it.

React — typed component

  • Install: npm install @mapjamaica/map-react (React 17+).
  • Props mirror the builder: center={[lat, lng]}, zoom, sel, mode, styleName, controls, layers, routes, markers, showNearby, origin.
  • Callbacks: onReady, onSelect, onMove. Grab a ref for the imperative handle: ref.current.setCenter(lat, lng).

Svelte 5 — typed component

  • Install: npm install @mapjamaica/map-svelte (Svelte 5+).
  • Props mirror the builder; callbacks are onready, onselect, onmove.
  • Use bind:this={mapRef} and call mapRef.setCenter(lat, lng) / mapRef.setLayers([...]) for programmatic control.

URL parameter reference

Every option below is also settable visually in the builder — the snippet encodes them for you.

ParamTypeDefaultDescription
clat,lng18.1096,-77.2975 (Jamaica centroid)Map centre. Same format the main MapJamaica app uses in its share URLs.
c=18.0179,-76.8099
znumber 0–2211Zoom level. 9 ≈ island overview, 13 ≈ city, 17 ≈ single building.
z=15
sellayerId:featureId(none)Pre-select a feature on load — its PlaceCard opens automatically when the placeCard control is enabled. The builder fills this for you when you pick a business.
sel=basemap:lodging:-77.166097,18.431349
modedefault | poi | parish | district | picker | locatordefaultScenario preset. poi = focused single-place view with its own control defaults; picker = taps drop a pin and post picker:point to your page.
mode=poi
stylestreets | satellite | hybridstreetsBasemap imagery. hybrid layers road labels over satellite.
style=satellite
controlsCSV of control ids, or "minimal"per-mode presetWhich UI controls render on the map. Omit for the mode preset; "minimal" = zoom only. See the controls reference below for every id.
controls=zoom,recenter,placeCard
interactivebooleantruefalse freezes the map (no pan/zoom/rotate) — useful for hero images and static cards.
interactive=false
layersCSV of layer ids, or "-"catalog defaultsWhich data layers are on. "-" turns everything off (clean basemap). See the layer reference below for every id.
layers=hospital,fuel
routesCSV of route ids(no filtering)Restrict transit layers to specific routes — live vehicles and route polylines outside the list are hidden. Use the route picker in the builder to find ids.
routes=jutc-900
markersJSON array[]Your own pins: lat, lng, optional label, hex color, and emoji icon. The builder’s stop editor writes this for you.
markers=[{"lat":18.01,"lng":-76.8,"label":"HQ","color":"#dc2626","icon":"🏨"}]
radiusmetres500 in poi mode, else nonePOI-mode context radius for nearby suggestions around the selected place.
radius=800
showNearbyCSV of category idspoi-mode presetPOI-mode: which categories surface as nearby context for the selected place.
showNearby=hospital,fuel
originCSV of origins(accept any parent)Security allowlist: only control messages (setCenter, setLayers, …) from these origins are honoured. Recommended for production embeds.
origin=https://yoursite.com
lockedtrueThe MapJamaica badge is always shown during the beta. It links to mapjamaica.com.
(not settable)
wCSS width100%Snippet hint only — sets the width attribute on the generated iframe tag.
w=100%25
hCSS height480Snippet hint only — sets the height attribute on the generated iframe tag.
h=480

Controls reference

Use these ids in controls=.

  • zoom

    Zoom + / − buttons on the right edge.

  • recenter

    Return-to-start button (flies back to the configured centre).

  • search

    Search box for places and addresses.

  • layerPanel

    Layer catalog panel for toggling data layers.

  • fullscreen

    Fullscreen toggle.

  • compass

    Compass (appears when the map is rotated).

  • scaleBar

    Metric scale bar.

  • directions

    Directions entry point.

  • streetView

    Mapillary street-view imagery entry point.

  • placeCard

    Info card that opens when a place is selected (or pre-opened via sel=).

Layers reference

Use these ids in layers=. This table is generated from the live catalog.

Layer idShowsGroup
parcels📐 Parcelsland
districts🗺️ Districtsland
parishes🗾 Parishesland
bus-stops🚏 Bus Stopstransit-bus
bus-routes🛣️ Bus Routestransit-bus
live-jutc🚌 JUTC Busestransit-bus
live-knutsford🚌 Knutsford Coachestransit-bus
school-bus-stops🏫 School Bus Stopstransit-school-bus
taxi-routes🛣️ Taxi Routestransit-taxi
live-taxis🚕 Live Taxistransit-taxi
fuel⛽ Gas Stationsplaces
overture-service🛒 More Places — Servicesplaces
overture-notice📋 More Places — Notice Venuesplaces
overture-recreation🌳 More Places — Recreationplaces
overture-civic🏛 More Places — Civic & Emergencyplaces
overture-transit🚌 More Places — Transitplaces
hospital🏥 Hospitalsfacilities
school🏫 Schoolsfacilities
police🚓 Policefacilities
fire🚒 Fire Stationsfacilities
library📚 Librariesfacilities
post-office📮 Post Officesfacilities
local-government🏛️ Local Governmentfacilities
justice-centre⚖️ Justice Centresfacilities
shelter🛟 Sheltersfacilities
for-sale🏠 For Salerealestate
for-rent🔑 For Rentrealestate
commerce🏪 Commercecommunity
notices📋 Noticescommunity
safety-alerts⚠️ Safety Alertscommunity
advisories📢 Advisoriesawareness
transport-alerts🚧 Transport Alertsawareness
disposal-sites🗑️ Disposal Siteswaste
nswma-trucks🚛 NSWMA Truckswaste

Events & programmatic control

The embed talks to your page over postMessage. Try them live: the builder's event log shows every message as you interact with the preview.

From the map to your page

ready { version: "v1" }

Fired once when the embedded map has loaded and is interactive.

window.addEventListener('message', (e) => {
  if (e.data?.source === 'mapjamaica' && e.data.type === 'ready') {
    console.log('map ready', e.data.payload.version);
  }
});
select { layerId, featureId, lat, lng, title } | null

Fired when the user selects a place (or the selection clears — payload null).

window.addEventListener('message', (e) => {
  if (e.data?.source === 'mapjamaica' && e.data.type === 'select' && e.data.payload) {
    console.log('picked', e.data.payload.title);
  }
});
move { center: { lat, lng }, zoom }

Fired after every map movement settles — pan, zoom, or programmatic fly.

window.addEventListener('message', (e) => {
  if (e.data?.source === 'mapjamaica' && e.data.type === 'move') {
    console.log('viewport', e.data.payload.center, e.data.payload.zoom);
  }
});
picker:point { lat, lng }

mode=picker only: fired when the user taps the map. Build address pickers with this.

window.addEventListener('message', (e) => {
  if (e.data?.source === 'mapjamaica' && e.data.type === 'picker:point') {
    document.querySelector('#lat').value = e.data.payload.lat;
    document.querySelector('#lng').value = e.data.payload.lng;
  }
});

From your page to the map

setCenter { lat, lng }

Fly the embedded map to a coordinate from your page.

iframe.contentWindow.postMessage(
  { source: 'mapjamaica', type: 'setCenter', payload: { lat: 18.0179, lng: -76.8099 } },
  'https://mapjamaica.com'
);
setZoom { zoom }

Change the zoom level from your page.

iframe.contentWindow.postMessage(
  { source: 'mapjamaica', type: 'setZoom', payload: { zoom: 14 } },
  'https://mapjamaica.com'
);
selectFeature { layerId, featureId } | null

Open a place’s card programmatically, or pass null to clear the selection.

iframe.contentWindow.postMessage(
  { source: 'mapjamaica', type: 'selectFeature', payload: null },
  'https://mapjamaica.com'
);
setLayers { layers: string[] | null }

Replace the active layer set. null restores catalog defaults; [] = all off.

iframe.contentWindow.postMessage(
  { source: 'mapjamaica', type: 'setLayers', payload: { layers: ['hospital', 'fuel'] } },
  'https://mapjamaica.com'
);

FAQ

Is embedding free?

Yes — embeds are free during the beta while we develop the platform. Terms may evolve after beta; embedded maps always remain attributed to MapJamaica.

Can I remove the MapJamaica badge?

Not during the beta — the badge is locked on and links back to mapjamaica.com. A white-label tier is under consideration; tell us if you need it.

How do I find route IDs for the routes= filter?

Use the Live transit example in the builder: search and tick the routes you want — the generated snippet carries the right ids (e.g. routes=jutc-900).

Why is a layer empty on my embed?

Two common causes: the layer has a minimum zoom (zoom in and it appears), or it is district-scoped (hospitals, schools, police) and fills in once the map settles over a district. Live vehicles only render while services are running.

The map area is blank — what happened?

The map needs WebGL. Browsers with hardware acceleration disabled show a built-in fallback message instead of the map. There is nothing to configure on your side.

Does it work on mobile and in page builders like WordPress or Wix?

Yes. The iframe snippet works in any custom-HTML block, and the map is mobile-first — pinch zoom, taps and the PlaceCard are designed for phones.

Is the embed secure? What data leaves my page?

The map runs inside the iframe on mapjamaica.com — your page and the map can only talk through the documented postMessage events. Set origin=https://yoursite.com so the map only accepts control messages from your site. The embed never reads your page.

Can I drive the map after it loads?

Yes — send setCenter, setZoom, selectFeature or setLayers via postMessage (or the equivalent methods on the web component / React / Svelte wrappers). See the events reference.

Are there rate limits?

Fair use during the beta: normal website traffic is fine. If you expect very high volume (100k+ map loads/month), get in touch first so we can plan capacity.

How do I report a problem or request a feature?

Email [email protected] with the embed URL from your snippet — it encodes your full configuration, which makes reproductions fast.