Getting your bearings…
v1.0.0 · No API key needed for basic embed
Add an interactive African map to any website with a single script tag. No build tools, no npm, no API key required for basic usage.
<script src="https://pechmap.com/sdk/v1/pmap.js"></script><div id="my-map" style="width:100%; height:400px; border-radius:12px;"></div>
<script src="https://pechmap.com/sdk/v1/pmap.js"></script>
<script>
const map = new PMap({
container: 'my-map',
center: [3.3792, 6.5244], // [lng, lat]
zoom: 13,
theme: 'dark',
})
</script>const map = new PMap({
container: 'my-map',
center: [8, 9],
zoom: 4,
theme: 'dark',
markers: [
{ lat: 6.5244, lng: 3.3792, label: 'Lagos', color: '#F59E0B' },
{ lat: 5.5502, lng: -0.2174, label: 'Accra', color: '#F59E0B' },
{ lat: -1.2921, lng: 36.8219, label: 'Nairobi', color: '#F59E0B' },
{ lat: -25.746, lng: 28.188, label: 'Pretoria', color: '#F59E0B' },
],
})
// Add a marker later
const markerId = map.addMarker({
lat: 9.0579, lng: 7.4951, label: 'Abuja', color: '#E7C878',
onClick: ({ label }) => alert('Clicked: ' + label),
})
// Remove it
map.removeMarker(markerId)
// Fit map to show all markers
map.fitMarkers()const map = new PMap({ container: 'my-map', zoom: 4 })
// Listen for map clicks
map.on('click', ({ lat, lng }) => {
console.log('Map clicked at', lat, lng)
})
// Marker click
map.on('markerClick', ({ id, label }) => {
console.log('Marker clicked:', label)
})
// Map ready
map.on('ready', () => {
console.log('Map is ready!')
map.flyTo(6.5244, 3.3792, 13)
})// Fly to a location (lat, lng, zoom)
map.flyTo(6.5244, 3.3792, 15)
// Change theme
map.setTheme('light') // or 'dark', 'africa', 'satellite'
// Get current position
const { lat, lng } = map.getCenter()
const zoom = map.getZoom()
// Resize (call after container size changes)
map.resize()
// Clean up
map.destroy()new PMap(options)Create a new map. Options: container, center, zoom, theme, markers, onReady, onMapClick.map.addMarker(options) → idAdd a marker. Options: lat, lng, label?, color?, id?, onClick?map.removeMarker(id)Remove a marker by ID.map.clearMarkers()Remove all markers.map.flyTo(lat, lng, zoom?)Animate the map to a position.map.setZoom(zoom)Set zoom level (1–20).map.getCenter() → {lat, lng}Get current center coordinates.map.getZoom() → numberGet current zoom level.map.setTheme(theme)Switch style: 'light' | 'dark' | 'africa' | 'satellite'.map.fitMarkers(padding?)Fit the map to show all current markers.map.on(event, fn)Listen for events: 'ready', 'click', 'zoom', 'move', 'markerClick'.map.off(event, fn)Remove an event listener.map.resize()Call after container dimensions change.map.destroy()Remove the map and clean up all resources.// Install
npm install @pmap/maps-sdk
// React usage
import { PmapMap } from '@pmap/maps-sdk'
export default function MyPage() {
return (
<PmapMap
center={[3.3792, 6.5244]}
zoom={13}
markers={[
{ id: '1', coordinates: [3.3792, 6.5244], popup: 'Lagos HQ' }
]}
onPlaceClick={(place) => console.log(place)}
style={{ height: '400px', borderRadius: '12px' }}
/>
)
}<!-- Service area map — amber pins on dark Africa map -->
<iframe
src="https://pechmap.com/embed/map?lat=9&lng=8&zoom=3&theme=dark&markers=[
{%22lat%22:6.5244,%22lng%22:3.3792,%22label%22:%22Lagos%22,%22color%22:%22%23F59E0B%22},
{%22lat%22:5.5502,%22lng%22:-0.2174,%22label%22:%22Accra%22,%22color%22:%22%23F59E0B%22}
]"
width="100%" height="380"
style="border:none; border-radius:12px;"
loading="lazy" allowfullscreen
title="PMap Service Areas">
</iframe>
<!-- Or fetch the snippet via API -->
<!-- GET https://pechmap.com/api/v1/embed?lat=9&lng=8&zoom=3&theme=dark -->Or use our embed generator to build the URL visually.
Need more — geocoding, routing, places search?
Use our REST API with an API key for full programmatic access.
View REST API docs