Adding interactive maps to your site helps visitors explore locations and data without extra clicks. It’s easy and powerful.
This guide covers:
- Choices of tools
- HTML iframe embeds
- JavaScript libraries (Leaflet)
- Dynamic maps with URL parameters
- Accessibility and performance tips
Why embed a map?
Interactive maps let users:
- Zoom, pan, and explore
- Access pop‐ups with details
- View live data (like route updates or points of interest)
- Stay on your page—no switching apps
Embed with an iframe—quick and easy
Many mapping services give iframe code. You copy and paste it into your site.
Google Maps Embed API example
Google Maps lets you embed places, views, directions, or street view:
<iframe
width="600"
height="450"
style="border:0"
loading="lazy"
allowfullscreen
referrerpolicy="no-referrer-when-downgrade"
src="https://www.google.com/maps/embed/v1/place?
key=YOUR_API_KEY
&q=Eiffel+Tower,Paris+France"
>
</iframe>
You’ll need an API key. Set width/height and policy—maps shouldn’t be smaller than 200×200 px.
Embed using a map platform (like Atlas)
Platforms like Atlas make it easier—no API key needed.
- Create your map in Atlas.
- Click Share, set to public.
- Copy the iframe embed code.
- Paste into your site’s HTML.
- Adjust width/height in the code.
Power BI and other tools can embed Atlas maps similarly.
Work faster with spatial data
Easily import data, automate analysis and build spatial apps for the web, all within a single software.
Embed with Leaflet.js — more control
Leaflet is a free open-source JS library. You host the map yourself.
Quick setup
- Include CSS & JS in your
<head>
:
<link
rel="stylesheet"
href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
/>
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script>
- Add a
<div>
for the map:
<div id="map" style="width: 600px; height: 400px;"></div>
- Initialize map in JS:
const map = L.map('map').setView([48.8584, 2.2945], 13) L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 19, attribution: '© OpenStreetMap contributors' }).addTo(map)
L.marker([48.8584, 2.2945]).addTo(map).bindPopup('Eiffel Tower').openPopup()
That shows a map with a marker and popup.
Add features:
- Custom icons: Use your own marker images
- GeoJSON layers: Add shapes, regions, data overlays
- Events: Click, tooltips, zoom, etc.
Accessibility & performance tips
- Alt text: Provide fallback text or static image
- Keyboard access: Leaflet supports keyboard zoom/pan
- Lazy load iframes to improve page load
- Tile caching: Use CDNs like Mapbox or OpenStreetMap for tiles
- Tile attribution: Must include credits for open-source tile providers
Best use cases
- Business or office location: Simple iframe embed works great
- Custom data maps: Use Leaflet or Atlas for shape overlays
- Interactive reports: Embedding via URL parameters shows user‑specific content
- No-code environments: Paste iframe into Notion, Power BI, or Framer
Needs | Use iframe | Use Leaflet | Use Atlas/Platform |
---|---|---|---|
Simple static location | ✅ Quick embed | ❌ Overkill | ✅ Easy |
Custom layers & data overlays | ❌ Limited | ✅ Full control | ✅ Medium/custom |
No-code tools users | ✅ Embed iframe | ❌ Needs code | ✅ Ideal |
Dynamic filters or URL views | ❌ Limited | ✅ Dev required | ✅ With widgets |
Realtime updates from dashboard | ❌ Manual update | ❌ Needs API | ✅ Live sync |