हर खुदरा ब्रांड, फ्रेंचाइज़ी और सेवा व्यवसाय को अंततः एक स्टोर लोकेटर की आवश्यकता होती है। यह वह पृष्ठ है जो ग्राहक तब देखते हैं जब वे पहले से ही खरीदना चाहते हैं, उन्हें बस यह जानना होगा कि किस शाखा में जाना है। वह पृष्ठ गलत होना वास्तविक रूपांतरण खर्च करता है। इसे सही तरीके से प्राप्त करना अधिकांश डेवलपर्स की तुलना में सरल है।
मानक दृष्टिकोण Google Maps रहा है, लेकिन यह एक लागत संरचना के साथ आता है जो पैमाने पर काटता है। 50,000 मासिक आगंतुकों के साथ एक व्यस्त खुदरा साइट एक मानचित्र पृष्ठ लोड करते हुए मानचित्र लोड और जियोकोडिंग शुल्क में रातोंरात सैकड़ों यूरो जमा कर सकती है। अब उत्पादन उपयोग के लिए कोई मुफ्त स्तर नहीं है, बिलिंग अस्पष्ट है, और EU व्यवसायों के लिए GDPR स्थिति एक US आधारित मानचित्र सेवा का उपयोग करते हुए अनुपालन ओवरहेड जोड़ता है।
यह ट्यूटोरियल MapAtlas Maps API और Geocoding API का उपयोग करके एक पूर्ण स्टोर लोकेटर, इंटरैक्टिव मानचित्र, पता खोज, सिंक्रोनाइज़ की गई सूची पैनल, मार्कर क्लस्टरिंग, और क्लिक-टू-विवरण पॉपअप बनाता है। कोई ढांचा आवश्यक नहीं है। पूरा काम करने वाला उदाहरण लगभग 80 लाइनों के HTML और JavaScript में फिट बैठता है। आप इसे WordPress कस्टम HTML ब्लॉक, Shopify सेक्शन, या किसी भी CMS में उसी दोपहर को डाल सकते हैं जिस दिन आप यह पढ़ते हैं।
अंत तक आपके पास होगा:
- अपने स्टोर नेटवर्क पर केंद्रित एक प्रदान किया गया वेक्टर मानचित्र
- कम ज़ूम पर क्लस्टरिंग के साथ JSON डेटा सरणी से लोड किए गए मार्कर
- Geocoding API द्वारा संचालित एक पता खोज बार
- एक सिंक्रोनाइज़ की गई सूची पैनल जो मानचित्र क्लिक पर हाइलाइट करती है
- एक मोबाइल-उत्तरदायी दो-स्तंभ लेआउट
स्टोर लोकेटर को वास्तव में क्या चाहिए
कोड की एक पंक्ति भी लिखने से पहले, आवश्यकताओं के बारे में सटीक होना मदद करता है। एक काम करने वाले स्टोर लोकेटर के चार चलते हुए भाग होते हैं:
- एक मानचित्र जो टाइलें प्रदान करता है, पैन और ज़ूम स्वीकार करता है, और मार्कर दिखाता है।
- एक खोज इनपुट जो उपयोगकर्ता के टाइप किए गए पते को निर्देशांक में जियोकोड करता है, फिर मानचित्र को फिर से केंद्रित करता है।
- एक मार्कर परत जो प्रत्येक स्टोर स्थान को प्लॉट करती है, कम ज़ूम पर पास के पिन को क्लस्टर करती है, और क्लिक पर एक विस्तृत पॉपअप खोलती है।
- एक सूची पैनल जो खोजे गए स्थान से दूरी द्वारा क्रमबद्ध स्टोर दिखाता है, सक्रिय स्टोर को हाइलाइट करता है, और मानचित्र के साथ सिंक में स्क्रॉल करता है।
बस इतना ही। हर दूसरी विशेषता, दिशाएं, खोलने के घंटे, इन्वेंटरी स्टॉक, इन चार के शीर्ष पर एक वृद्धि है। पहले कोर बनाएं।
Step 1: Load the MapAtlas SDK
The MapAtlas Maps API is compatible with the Mapbox GL JS interface, so any Mapbox GL JS tutorial or plugin works directly. Add the CDN links to your page <head>:
<link
rel="stylesheet"
href="https://unpkg.com/@mapmetrics/mapmetrics-gl/dist/mapmetrics-gl.css"
/>
<script src="https://unpkg.com/@mapmetrics/mapmetrics-gl/dist/mapmetrics-gl.js"></script>
If you are using npm:
npm install @mapmetrics/mapmetrics-gl
Get your free API key at portal.mapmetrics.org/signup. One key covers map tiles, geocoding, and routing, no separate credentials to juggle.
Step 2: Define Your Store Data
Store data is just a GeoJSON FeatureCollection. Each feature carries the store's coordinates and whatever properties your popup needs: name, address, phone, opening hours.
const stores = {
type: "FeatureCollection",
features: [
{
type: "Feature",
geometry: { type: "Point", coordinates: [4.9041, 52.3676] },
properties: {
id: 1,
name: "Amsterdam Central",
address: "Stationsplein 12, 1012 AB Amsterdam",
phone: "+31 20 123 4567",
hours: "Mon–Sat 09:00–20:00"
}
},
{
type: "Feature",
geometry: { type: "Point", coordinates: [4.4777, 51.9244] },
properties: {
id: 2,
name: "Rotterdam Lijnbaan",
address: "Lijnbaan 10, 3012 EL Rotterdam",
phone: "+31 10 987 6543",
hours: "Mon–Sat 09:00–21:00"
}
},
{
type: "Feature",
geometry: { type: "Point", coordinates: [5.1214, 52.0907] },
properties: {
id: 3,
name: "Utrecht Centrum",
address: "Oudegracht 45, 3511 AB Utrecht",
phone: "+31 30 555 1234",
hours: "Mon–Sun 10:00–19:00"
}
}
]
};
In production you would fetch this from an API endpoint or a CMS. The structure stays the same, the only difference is where the data originates.
Step 3: Render the Map and Add Clustering
Initialize the map, add the store data as a GeoJSON source with clustering enabled, and paint the cluster circles and individual pin layer. Mapbox GL JS clustering is built into the source definition, no plugin required.
const map = new mapmetricsgl.Map({
container: 'map',
style: 'https://tiles.mapatlas.eu/styles/basic/style.json?key=YOUR_API_KEY',
center: [5.2913, 52.1326], // Centre of the Netherlands
zoom: 7
});
map.on('load', () => {
// Add GeoJSON source with clustering
map.addSource('stores', {
type: 'geojson',
data: stores,
cluster: true,
clusterMaxZoom: 12,
clusterRadius: 50
});
// Cluster circles
map.addLayer({
id: 'clusters',
type: 'circle',
source: 'stores',
filter: ['has', 'point_count'],
paint: {
'circle-color': '#3B82F6',
'circle-radius': ['step', ['get', 'point_count'], 20, 10, 28, 30, 36]
}
});
// Cluster count labels
map.addLayer({
id: 'cluster-count',
type: 'symbol',
source: 'stores',
filter: ['has', 'point_count'],
layout: {
'text-field': '{point_count_abbreviated}',
'text-size': 13
},
paint: { 'text-color': '#ffffff' }
});
// Individual store pins
map.addLayer({
id: 'unclustered-point',
type: 'circle',
source: 'stores',
filter: ['!', ['has', 'point_count']],
paint: {
'circle-color': '#EF4444',
'circle-radius': 8,
'circle-stroke-width': 2,
'circle-stroke-color': '#ffffff'
}
});
});
Clicking a cluster zooms in to reveal individual stores. Clicking an unclustered pin opens a popup.
Step 4: Wire Up Popups and the List Panel
When a user clicks a store pin, show a popup on the map and highlight the matching card in the list panel. Both interactions should be bidirectional, clicking a list card should also fly the map to that store.
// Click unclustered store → open popup + highlight list card
map.on('click', 'unclustered-point', (e) => {
const { coordinates } = e.features[0].geometry;
const { name, address, phone, hours, id } = e.features[0].properties;
new mapmetricsgl.Popup()
.setLngLat(coordinates)
.setHTML(`
<strong>${name}</strong>
<p>${address}</p>
<p>${phone}</p>
<p>${hours}</p>
`)
.addTo(map);
highlightCard(id);
});
// Click cluster → zoom in
map.on('click', 'clusters', (e) => {
const features = map.queryRenderedFeatures(e.point, { layers: ['clusters'] });
const clusterId = features[0].properties.cluster_id;
map.getSource('stores').getClusterExpansionZoom(clusterId, (err, zoom) => {
if (err) return;
map.easeTo({ center: features[0].geometry.coordinates, zoom });
});
});
function highlightCard(id) {
document.querySelectorAll('.store-card').forEach(card => {
card.classList.toggle('active', card.dataset.id === String(id));
});
}
// Build list panel from store data
function buildListPanel() {
const list = document.getElementById('store-list');
stores.features.forEach(({ properties, geometry }) => {
const card = document.createElement('div');
card.className = 'store-card';
card.dataset.id = properties.id;
card.innerHTML = `
<strong>${properties.name}</strong>
<p>${properties.address}</p>
<small>${properties.hours}</small>
`;
card.addEventListener('click', () => {
map.flyTo({ center: geometry.coordinates, zoom: 14 });
highlightCard(properties.id);
});
list.appendChild(card);
});
}
Step 5: Add Address Search with the Geocoding API
The search bar takes a user's typed location, geocodes it via the Geocoding API, flies the map to that point, and re-sorts the list panel by distance.
async function searchLocation(query) {
const url = new URL('https://api.mapatlas.eu/geocoding/v1/search');
url.searchParams.set('text', query);
url.searchParams.set('key', 'YOUR_API_KEY');
const res = await fetch(url);
const data = await res.json();
if (!data.features.length) {
alert('Address not found. Try a city or postcode.');
return;
}
const [lng, lat] = data.features[0].geometry.coordinates;
// Fly map to searched location
map.flyTo({ center: [lng, lat], zoom: 10 });
// Sort list by distance from searched point
const sorted = [...stores.features].sort((a, b) => {
const distA = haversine(lat, lng, a.geometry.coordinates[1], a.geometry.coordinates[0]);
const distB = haversine(lat, lng, b.geometry.coordinates[1], b.geometry.coordinates[0]);
return distA - distB;
});
document.getElementById('store-list').innerHTML = '';
sorted.forEach(feature => {
// Re-render each card (reuse buildListPanel logic)
});
}
function haversine(lat1, lon1, lat2, lon2) {
const R = 6371;
const dLat = ((lat2 - lat1) * Math.PI) / 180;
const dLon = ((lon2 - lon1) * Math.PI) / 180;
const a =
Math.sin(dLat / 2) ** 2 +
Math.cos((lat1 * Math.PI) / 180) *
Math.cos((lat2 * Math.PI) / 180) *
Math.sin(dLon / 2) ** 2;
return R * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
}
document.getElementById('search-btn').addEventListener('click', () => {
const query = document.getElementById('search-input').value.trim();
if (query) searchLocation(query);
});
Step 6: Mobile-Responsive Layout
A store locator on mobile must stack vertically, map on top, list below, rather than side by side. Twenty lines of CSS handles this with a single media query breakpoint.
#locator-wrapper {
display: flex;
height: 600px;
gap: 0;
}
#store-list {
width: 300px;
overflow-y: auto;
border-right: 1px solid #e5e7eb;
padding: 12px;
}
#map {
flex: 1;
}
.store-card {
padding: 12px;
border-radius: 8px;
cursor: pointer;
margin-bottom: 8px;
border: 2px solid transparent;
transition: border-color 0.2s;
}
.store-card.active {
border-color: #3B82F6;
background: #EFF6FF;
}
@media (max-width: 640px) {
#locator-wrapper {
flex-direction: column;
height: auto;
}
#store-list {
width: 100%;
border-right: none;
border-top: 1px solid #e5e7eb;
height: 280px;
}
#map {
height: 350px;
}
}
Google Maps के साथ बिलिंग और GDPR तुलना
यदि आप एक खुदरा साइट पर Google Maps चला रहे हैं और आश्चर्य कर रहे हैं कि इस महीने का बिल की अपेक्षा से अधिक क्यों आया है, तो आप अकेले नहीं हैं। Maps JavaScript API मानचित्र लोड के अनुसार शुल्क लेता है। Places API ऑटोकंपlete सत्र प्रति और जियोकोडिंग अनुरोध प्रति शुल्क लेता है। वह लागत तेजी से जटिल होती है। एक साइट जो महीने में 50,000 बार देखी जाती है, प्रत्येक बार स्टोर लोकेटर पृष्ठ को एक बार लोड करते हुए, एक एकल जियोकोडिंग कॉल से पहले अकेले मानचित्र लोड पर प्रति माह €140 के आसपास खर्च करता है।
MapAtlas सपाट मासिक योजनाएं का उपयोग करता है। कोई प्रति-लोड या प्रति-अनुरोध चार्ज नहीं है जो बिना चेतावनी के बढ़ता है। आप Google Maps API Pricing in 2026: The True Cost Breakdown और MapAtlas vs. Google Maps comparison में पूर्ण ब्रेकडाउन पढ़ सकते हैं।
EU डेवलपर्स के लिए GDPR कोण भी मायने रखता है। Google Maps US इंफ्रास्ट्रक्चर के माध्यम से डेटा रूट करता है। MapAtlas EU-होस्ट किया गया है, ISO 27001 प्रमाणित है, और EU के भीतर सभी अनुरोधों को संसाधित करता है। खुदरा व्यवसायों के लिए जो पहले से ही ग्राहक सहमति को सावधानी से प्रबंधित कर रहे हैं, एक EU-मूल मानचित्र प्रदाता का उपयोग करना अपनी गोपनीयता नीति से एक और तीसरे पक्ष के हस्तांतरण को हटाता है।
सब कुछ एक साथ रखना
संपूर्ण स्टोर लोकेटर, HTML संरचना, CSS लेआउट, मानचित्र init, क्लस्टरिंग, पॉपअप हैंडलिंग, सूची पैनल, खोज, और दूरी क्रमबद्ध, एक फाइल में आराम से फिट बैठता है। संरचना इस तरह दिखती है:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Store Locator</title>
<link rel="stylesheet"
href="https://unpkg.com/@mapmetrics/mapmetrics-gl/dist/mapmetrics-gl.css" />
<script src="https://unpkg.com/@mapmetrics/mapmetrics-gl/dist/mapmetrics-gl.js"></script>
<style>
/* paste the CSS from Step 6 here */
</style>
</head>
<body>
<div id="search-bar">
<input id="search-input" type="text" placeholder="Enter your city or postcode…" />
<button id="search-btn">Search</button>
</div>
<div id="locator-wrapper">
<div id="store-list"></div>
<div id="map"></div>
</div>
<script>
// paste store data, map init, clustering, popup, list panel, and search from Steps 2–5
</script>
</body>
</html>
परिणाम MapAtlas SDK से परे शून्य बाहरी निर्भरता के साथ एक उत्पादन-तैयार स्टोर लोकेटर है। कोई बिल्ड चरण नहीं है, कोई ढांचा नहीं है, और कोई चल रहा बिलिंग आश्चर्य नहीं है।
यदि आपको रूटिंग जोड़ने की आवश्यकता है, "मेरे स्थान से इस स्टोर तक दिशाएं प्राप्त करें", Routing API उपयोगकर्ता के निर्देशांक लेता है और स्टोर के निर्देशांक लेता है और एक पूर्ण मोड़-दर-मोड़ मार्ग लौटाता है जो आप एक लाइन परत के रूप में मानचित्र पर आकर्षित कर सकते हैं। How to Add Interactive Maps to Your Website ट्यूटोरियल विस्तार से अगले चरण को कवर करता है।
अगले कदम
- निःशुल्क MapAtlas API key के लिए साइन अप करें, कोई क्रेडिट कार्ड की आवश्यकता नहीं
- क्लस्टरिंग, कस्टम स्टाइलिंग, और परत विकल्पों के लिए Maps API documentation ब्राउज़ करें
- पोस्टकोड लुकअप, रिवर्स जियोकोडिंग, और पता ऑटोकंपlete के लिए Geocoding API का अन्वेषण करें
Frequently Asked Questions
Can I build a store locator without Google Maps?
Yes. MapAtlas provides a Mapbox GL JS-compatible Maps API and a Geocoding API that cover every feature a store locator needs, interactive map, address search, marker clustering, and popups, with no per-load billing and full GDPR compliance.
How much does a store locator cost to run on MapAtlas vs Google Maps?
MapAtlas is roughly 75% cheaper than Google Maps for equivalent usage. Google Maps charges per map load and per geocoding request, which adds up fast on a busy retail site. MapAtlas uses flat monthly plans with no per-request surprises.
Does MapAtlas work on WordPress and Shopify?
Yes. Because MapAtlas is pure JavaScript with no framework dependency, you can embed it in a WordPress custom HTML block, a Shopify theme section, or any CMS that lets you add a script tag and a div.

