Google বছরের পর বছর ধরে Maps Platform কঠিন করে তুলছে, তবে মে ২০২৬ এর deprecation wave এখন পর্যন্ত সবচেয়ে বড় পরিবর্তন। Maps JavaScript API থেকে চারটি widely used feature সরিয়ে দেওয়া হচ্ছে: Heatmap Layer, Drawing Library, DirectionsService এবং DistanceMatrixService। আপনার application যদি এর কোনোটির উপর নির্ভর করে, তাহলে code বন্ধ হওয়ার আগে migrate করতে মাত্র কয়েক সপ্তাহ সময় আছে।
এটি কোনো soft deprecation নয় যেখানে পুরনো endpoints বছরের পর বছর থাকে। Google হার্ড removal তারিখ নির্ধারণ করেছে এবং developer console ইতিমধ্যে warnings দেখাচ্ছে। এই গাইডে ঠিক কী পরিবর্তন হচ্ছে, Google কেন এটা করছে এবং কাজ করার code examples সহ প্রতিটি service কীভাবে migrate করবেন তা বিস্তারিত বলা হয়েছে। আপনি যদি drop-in replacement চান, আমরা দেখাবো MapAtlas API গুলো কীভাবে প্রতিটি deprecated Google service এর সাথে মেলে।
কী Deprecated হচ্ছে এবং কখন
আক্রান্ত services এর পূর্ণ timeline:
| Service | Deprecated | Removal তারিখ | Replacement (Google) |
|---|---|---|---|
| Heatmap Layer (Maps JS API) | আগস্ট ২০২৫ | মে ২০২৬ | Maps Datasets API + deck.gl |
| Drawing Library (Maps JS API) | মে ২০২৫ | মে ২০২৬ | Extended Component Library |
| DirectionsService (Maps JS API) | ২৫ ফেব্রুয়ারি ২০২৬ | মে ২০২৬ | Routes API (REST) |
| DistanceMatrixService (Maps JS API) | ২৫ ফেব্রুয়ারি ২০২৬ | মে ২০২৬ | Routes API (REST) |
গুরুত্বপূর্ণ বিষয়: Google routing এবং distance calculation পুরোপুরি সরিয়ে দিচ্ছে না। সরানো হচ্ছে JavaScript client-side classes যেগুলো developers এক দশকেরও বেশি সময় ধরে ব্যবহার করে আসছে, এবং নতুন Routes API তে migration বাধ্যতামূলক করা হচ্ছে যেটি server-side REST endpoint। এটি সাধারণ version bump নয়। এটি একটি architectural পরিবর্তন যা routing logic কে browser থেকে আপনার backend এ নিয়ে যায়।
কী ভেঙে পড়বে
আপনার codebase এ নিচের কোনোটি থাকলে, removal date এর পরে সেটি fail করবে:
// All of these will stop working in May 2026
const directionsService = new google.maps.DirectionsService();
const distanceMatrixService = new google.maps.DistanceMatrixService();
const heatmap = new google.maps.visualization.HeatmapLayer({ data: points });
const drawingManager = new google.maps.drawing.DrawingManager();
Removal এর পরে এই constructors error throw করবে। কোনো fallback behavior নেই, কোনো graceful degradation নেই। Map load হবে, কিন্তু এই classes এর উপর নির্ভরশীল যেকোনো feature পুরোপুরি ভেঙে পড়বে।
Google কেন এই পরিবর্তনগুলো বাধ্য করছে
Google এর official কারণ performance এবং modernization। Routes API, যা DirectionsService এবং DistanceMatrixService এর replacement, নতুন features support করে যেমন eco-friendly routing, two-wheeled vehicle routing, এবং toll cost estimation যা legacy JavaScript classes accommodate করতে পারে না।
আসল কারণ pricing control। Routing কে server-side REST API তে নিয়ে গিয়ে, Google আরো detailed billing এবং usage tracking পায়। JavaScript DirectionsService client-side batching patterns allow করত যা Google এর পক্ষে accurately meter করা কঠিন ছিল। Routes API নিশ্চিত করে যে প্রতিটি request একটি measured endpoint এর মধ্য দিয়ে যায়।
Heatmap Layer এবং Drawing Library এর জন্য, Google developers দের Extended Component Library এবং deck.gl এর মতো third-party visualization tools এর দিকে ঠেলে দিচ্ছে। এটি একটি বৃহত্তর pattern এর অংশ: Google core map tile rendering নিজের কাছে রাখে এবং বাকি সব ecosystem এ outsource করে।
Developers এর জন্য practical impact: আরো backend infrastructure, manage করার জন্য আরো API keys, এবং বেশিরভাগ ক্ষেত্রে নতুন pricing tiers এ per request উচ্চতর খরচ।
মাইগ্রেশন চেকলিস্ট
কোনো migration code লেখার আগে এই checklist অনুসরণ করুন:
১. Codebase Audit করুন
Deprecated classes এর references এর জন্য codebase search করুন:
# Find all files using deprecated Google Maps services
grep -rn "DirectionsService\|DistanceMatrixService\|HeatmapLayer\|visualization.HeatmapLayer\|drawing.DrawingManager\|DrawingManager" \
--include="*.js" --include="*.ts" --include="*.tsx" --include="*.jsx" src/
এই services ব্যবহার করা প্রতিটি file এবং component document করুন। Calls client-side (browser) এ নাকি server-rendered context এ হচ্ছে তা নোট করুন, যেমন Next.js API routes।
২. Usage Patterns চিহ্নিত করুন
প্রতিটি ব্যবহারের জন্য document করুন:
- ব্যবহৃত travel modes (driving, walking, cycling, transit)
- Waypoint support (simple A-to-B, বা multi-stop routes)
- Consumed response fields (distance, duration, polyline, steps, fare)
- Volume (cost estimation এর জন্য requests per day/month)
- Latency requirements (real-time user-facing, বা batch processing)
৩. Migration Target বেছে নিন
দুটি option আছে:
Option A: Google এর সাথে থাকুন। Deprecated JavaScript classes থেকে নতুন Google Routes API (REST) তে migrate করুন। এর জন্য backend changes, নতুন API key permissions, এবং updated billing দরকার।
Option B: Provider বদলান। Third-party routing API তে migrate করুন। যেহেতু integration code যেকোনোভাবেই rewrite করতে হবে, এটি alternatives evaluate করার সঠিক সময়।
৪. Parallel Environment Set Up করুন
কখনো in-place migrate করবেন না। Cutover এর আগে কমপক্ষে দুই সপ্তাহ old এবং new implementations পাশাপাশি চালান, accuracy এবং latency এর results compare করুন।
৫. Error Handling Update করুন
Deprecated services callback functions এর মাধ্যমে errors return করত। REST API replacements HTTP status codes return করে। আপনার error handling logic সেই অনুযায়ী পরিবর্তন করতে হবে।
API-by-API Replacement Guide
DirectionsService থেকে MapAtlas Directions API তে
আগে (Google, deprecated):
const directionsService = new google.maps.DirectionsService();
directionsService.route(
{
origin: { lat: 52.52, lng: 13.405 },
destination: { lat: 48.8566, lng: 2.3522 },
travelMode: google.maps.TravelMode.DRIVING,
waypoints: [
{ location: { lat: 50.9375, lng: 6.9603 }, stopover: true }
],
},
(result, status) => {
if (status === "OK") {
const route = result.routes[0];
console.log("Distance:", route.legs[0].distance.text);
console.log("Duration:", route.legs[0].duration.text);
}
}
);
পরে (MapAtlas Directions API):
const response = await fetch(
"https://api.mapatlas.com/v1/directions?" +
new URLSearchParams({
origin: "52.52,13.405",
destination: "48.8566,2.3522",
waypoints: "50.9375,6.9603",
mode: "driving",
key: process.env.MAPATLAS_API_KEY!,
})
);
const data = await response.json();
if (data.status === "OK") {
const leg = data.routes[0].legs[0];
console.log("Distance:", leg.distance.text);
console.log("Duration:", leg.duration.text);
// Polyline for map rendering
const polyline = data.routes[0].overview_polyline;
}
মূল পার্থক্য:
- JavaScript class এর পরিবর্তে REST endpoint। Calls browser থেকে নয়, আপনার backend থেকে যায়।
- সহজ authentication। Query string বা header এ একটি API key।
- একই response structure। Routes, legs, distance, duration এবং polyline সবই আছে।
DistanceMatrixService থেকে MapAtlas Matrix API তে
আগে (Google, deprecated):
const service = new google.maps.DistanceMatrixService();
service.getDistanceMatrix(
{
origins: [
{ lat: 52.52, lng: 13.405 },
{ lat: 48.1351, lng: 11.582 },
],
destinations: [
{ lat: 48.8566, lng: 2.3522 },
{ lat: 51.5074, lng: -0.1278 },
],
travelMode: google.maps.TravelMode.DRIVING,
},
(response, status) => {
if (status === "OK") {
response.rows.forEach((row, i) => {
row.elements.forEach((element, j) => {
console.log(`Origin ${i} -> Dest ${j}:`,
element.distance.text, element.duration.text);
});
});
}
}
);
পরে (MapAtlas Matrix API):
const response = await fetch("https://api.mapatlas.com/v1/matrix", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.MAPATLAS_API_KEY}`,
},
body: JSON.stringify({
origins: [
{ lat: 52.52, lng: 13.405 },
{ lat: 48.1351, lng: 11.582 },
],
destinations: [
{ lat: 48.8566, lng: 2.3522 },
{ lat: 51.5074, lng: -0.1278 },
],
mode: "driving",
}),
});
const data = await response.json();
data.rows.forEach((row: any, i: number) => {
row.elements.forEach((element: any, j: number) => {
console.log(`Origin ${i} -> Dest ${j}:`,
element.distance.text, element.duration.text);
});
});
Response shape প্রায় একই। মূল পরিবর্তন হলো callback-based browser API থেকে promise-based server API তে যাওয়া।
Heatmap Layer Replacement
Heatmap visualization এর জন্য, migration path আপনার requirements এর উপর নির্ভর করে:
Option 1: MapLibre GL JS with a heatmap layer (open source)
import maplibregl from "maplibre-gl";
const map = new maplibregl.Map({
container: "map",
style: "https://api.mapatlas.com/v1/styles/streets?key=YOUR_KEY",
center: [13.405, 52.52],
zoom: 10,
});
map.on("load", () => {
map.addSource("heat-data", {
type: "geojson",
data: {
type: "FeatureCollection",
features: heatmapPoints.map((point) => ({
type: "Feature",
geometry: { type: "Point", coordinates: [point.lng, point.lat] },
properties: { weight: point.weight },
})),
},
});
map.addLayer({
id: "heatmap-layer",
type: "heatmap",
source: "heat-data",
paint: {
"heatmap-weight": ["get", "weight"],
"heatmap-intensity": 1,
"heatmap-radius": 20,
"heatmap-opacity": 0.7,
},
});
});
এটি heatmap rendering এর উপর সম্পূর্ণ নিয়ন্ত্রণ দেয় এবং Google এর tile servers এর উপর নির্ভর করে না।
Option 2: deck.gl HeatmapLayer (Google এর নিজস্ব recommendation)
import { Deck } from "@deck.gl/core";
import { HeatmapLayer } from "@deck.gl/aggregation-layers";
const heatmapLayer = new HeatmapLayer({
data: heatmapPoints,
getPosition: (d) => [d.lng, d.lat],
getWeight: (d) => d.weight,
radiusPixels: 30,
});
দুটো option ই কাজ করে। MapLibre GL JS MapAtlas tile styles এর সাথে cleanly integrate হয়, আর deck.gl যেকোনো base map এ overlay করা যায়।
খরচের তুলনা: Google Routes API বনাম MapAtlas
Google এর নিজস্ব Routes API তে migrate করা শুধু code পরিবর্তন নয়। এর সাথে নতুন pricing আসে:
| Service | Google (legacy, প্রতি ১,০০০) | Google Routes API (প্রতি ১,০০০) | MapAtlas (প্রতি ১,০০০) |
|---|---|---|---|
| Directions (basic) | $৫.০০ | $৫.০০ | $১.৫০ |
| Directions (advanced, waypoints/traffic) | $১০.০০ | $১০.০০ | $২.৫০ |
| Distance Matrix (per element) | $৫.০০ | $৫.০০ | $১.০০ |
| Distance Matrix (advanced) | $১০.০০ | $১০.০০ | $২.০০ |
| Geocoding | $৫.০০ | $৫.০০ | $১.৫০ |
মাসে ১০০,০০০ routing requests এ:
- Google Routes API: প্রায় $৫০০-$১,০০০ (ব্যবহৃত features এর উপর নির্ভরশীল)
- MapAtlas Directions API: প্রায় $১৫০-$২৫০
যে applications routing কে geocoding এবং distance calculations এর সাথে combine করে তাদের জন্য savings দ্রুত জমতে থাকে। একটি logistics platform যা মাসে ৫০০,০০০ matrix elements process করে সে Google এ প্রায় $২,৫০০ বনাম MapAtlas এ $৫০০ দেবে।
সম্পূর্ণ pricing details এর জন্য MapAtlas pricing দেখুন।
Code Migration উদাহরণ: সম্পূর্ণ Before/After
একটি React component এর জন্য সম্পূর্ণ migration example যা map এ driving directions দেখায়।
আগে: React এ Google Maps DirectionsService
import { useEffect, useRef } from "react";
function DirectionsMap({ origin, destination }: {
origin: google.maps.LatLngLiteral;
destination: google.maps.LatLngLiteral;
}) {
const mapRef = useRef<HTMLDivElement>(null);
useEffect(() => {
const map = new google.maps.Map(mapRef.current!, {
center: origin,
zoom: 7,
});
const directionsRenderer = new google.maps.DirectionsRenderer();
directionsRenderer.setMap(map);
const directionsService = new google.maps.DirectionsService();
directionsService.route(
{
origin,
destination,
travelMode: google.maps.TravelMode.DRIVING,
},
(result, status) => {
if (status === "OK" && result) {
directionsRenderer.setDirections(result);
}
}
);
}, [origin, destination]);
return <div ref={mapRef} style={{ width: "100%", height: "400px" }} />;
}
পরে: MapAtlas Directions API with MapLibre GL JS
import { useEffect, useRef } from "react";
import maplibregl from "maplibre-gl";
function DirectionsMap({ origin, destination }: {
origin: { lat: number; lng: number };
destination: { lat: number; lng: number };
}) {
const mapRef = useRef<HTMLDivElement>(null);
useEffect(() => {
const map = new maplibregl.Map({
container: mapRef.current!,
style: "https://api.mapatlas.com/v1/styles/streets?key=YOUR_KEY",
center: [origin.lng, origin.lat],
zoom: 7,
});
map.on("load", async () => {
// Fetch directions from your backend (or directly if CORS allows)
const res = await fetch(
`/api/directions?` +
new URLSearchParams({
origin: `${origin.lat},${origin.lng}`,
destination: `${destination.lat},${destination.lng}`,
mode: "driving",
})
);
const data = await res.json();
if (data.routes?.[0]) {
const coordinates = data.routes[0].geometry.coordinates;
map.addSource("route", {
type: "geojson",
data: {
type: "Feature",
geometry: { type: "LineString", coordinates },
properties: {},
},
});
map.addLayer({
id: "route-line",
type: "line",
source: "route",
paint: {
"line-color": "#4A90D9",
"line-width": 5,
},
});
// Fit map to route bounds
const bounds = coordinates.reduce(
(b: maplibregl.LngLatBounds, coord: [number, number]) =>
b.extend(coord),
new maplibregl.LngLatBounds(coordinates[0], coordinates[0])
);
map.fitBounds(bounds, { padding: 50 });
}
});
return () => map.remove();
}, [origin, destination]);
return <div ref={mapRef} style={{ width: "100%", height: "400px" }} />;
}
Backend API Route (Next.js)
// app/api/directions/route.ts
import { NextRequest, NextResponse } from "next/server";
export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url);
const origin = searchParams.get("origin");
const destination = searchParams.get("destination");
const mode = searchParams.get("mode") || "driving";
const response = await fetch(
`https://api.mapatlas.com/v1/directions?` +
new URLSearchParams({
origin: origin!,
destination: destination!,
mode,
key: process.env.MAPATLAS_API_KEY!,
})
);
const data = await response.json();
return NextResponse.json(data);
}
এই pattern API key কে server এ রাখে এবং client এ শুধু route geometry expose করে।
Deadline এর আগে Migration কীভাবে Test করবেন
Step 1: উভয় API Parallel এ চালান
Cutover এর দুই সপ্তাহ আগে, প্রতিটি request এর জন্য পুরনো Google service এবং নতুন replacement উভয়কেই call করুন। উভয় responses log করুন এবং compare করুন:
async function getDirectionsWithComparison(
origin: string,
destination: string
) {
const [googleResult, mapatResult] = await Promise.all([
fetchGoogleDirections(origin, destination),
fetchMapAtlasDirections(origin, destination),
]);
// Compare key metrics
const distanceDelta = Math.abs(
googleResult.distance - mapatResult.distance
);
const durationDelta = Math.abs(
googleResult.duration - mapatResult.duration
);
console.log({
route: `${origin} -> ${destination}`,
googleDistance: googleResult.distance,
mapatDistance: mapatResult.distance,
distanceDeltaPercent: ((distanceDelta / googleResult.distance) * 100).toFixed(1),
googleDuration: googleResult.duration,
mapatDuration: mapatResult.duration,
durationDeltaPercent: ((durationDelta / googleResult.duration) * 100).toFixed(1),
});
// Use MapAtlas result in production, Google as validation
return mapatResult;
}
Step 2: Feature Flags Set Up করুন
Application কোন API call করবে তা control করতে feature flag ব্যবহার করুন। এটি সমস্যা হলে instant rollback করতে দেয়:
const useMapAtlasDirections = process.env.FEATURE_MAPATLAS_DIRECTIONS === "true";
const directions = useMapAtlasDirections
? await fetchMapAtlasDirections(origin, destination)
: await fetchGoogleDirections(origin, destination);
Step 3: Error Rates Monitor করুন
Switch করার পরে monitor করুন:
- নতুন API থেকে HTTP 4xx/5xx error rates
- Latency বৃদ্ধি (নতুন provider এর ভিন্ন response times থাকতে পারে)
- Responses এ missing fields যার উপর আপনার UI নির্ভর করে
- Edge cases এর জন্য route accuracy (ferry routes, toll roads, restricted areas)
Step 4: Go-Live এর আগে Load Test করুন
যদি আপনার application spikes handle করে, যেমন morning dispatch এর সময় একটি logistics platform, তাহলে peak volume এর ২x এ নতুন API load test করুন। MapAtlas production billing ছাড়াই load testing এর জন্য sandbox environment দেয়।
Timeline: এই সপ্তাহে কী করবেন
যদি এখনো migrate শুরু না করে থাকেন, priority order এটি:
১. এই সপ্তাহে: Codebase audit করুন। চারটি deprecated services এর প্রতিটি usage চিহ্নিত করুন। ২. সপ্তাহ ২: MapAtlas account খুলুন এবং API keys নিন। Free tier testing এর জন্য ১০,০০০ requests cover করে। ৩. সপ্তাহ ৩: সবচেয়ে critical service এর replacement implement করুন, সাধারণত DirectionsService। ৪. সপ্তাহ ৪: বাকি services migrate করুন এবং parallel testing চালান। ৫. মে deadline এর আগে: Cutover করুন, Google API dependencies সরান, billing আপডেট করুন।
Migration optional নয়। মে ২০২৬ এর পরে, deprecated classes Maps JavaScript API থেকে সরিয়ে দেওয়া হবে এবং সেগুলো reference করা যেকোনো code runtime errors throw করবে। এখনই শুরু করলে সঠিকভাবে test করার সময় পাবেন। শেষ সপ্তাহ পর্যন্ত অপেক্ষা করলে চাপের মধ্যে production patch করতে হবে।
Migration support এর জন্য, MapAtlas সরাসরি developer assistance দেয়। Contact page এর মাধ্যমে যোগাযোগ করুন অথবা আপনার requirements এর বিপরীতে replacement APIs evaluate করতে API documentation দিয়ে শুরু করুন।
সাধারণ জিজ্ঞাসা
Google Maps API deprecations ঠিক কখন কার্যকর হবে?
Heatmap Layer এবং Drawing Library যথাক্রমে আগস্ট এবং মে ২০২৫ এ deprecated করা হয়েছে, মে ২০২৬ এ removal নির্ধারিত। DirectionsService এবং DistanceMatrixService ২৫ ফেব্রুয়ারি ২০২৬ এ deprecated হয়েছে, এগুলোরও মে ২০২৬ removal target। Removal এর পরে এই services এ API call করলে error আসবে।
মে ২০২৬ এর পরেও কি আমার existing Google Maps JavaScript API key কাজ করবে?
আপনার API key deprecated নয় এমন services এর জন্য কাজ করতে থাকবে। কিন্তু Maps JavaScript API দিয়ে DirectionsService, DistanceMatrixService, Heatmap Layer বা Drawing Library call করা যেকোনো code বন্ধ হয়ে যাবে। Deadline এর আগেই এই specific call গুলো replacement API তে migrate করতে হবে।
Google Maps Directions API এর সবচেয়ে সস্তা বিকল্প কোনটি?
MapAtlas Google এর সমতুল্যের চেয়ে প্রায় ৭০% কম খরচে Directions API অফার করে। Free tier এ মাসে ১০,০০০ request অন্তর্ভুক্ত, যা মাইগ্রেশন develop এবং test করার জন্য যথেষ্ট। অন্য বিকল্পের মধ্যে আছে Mapbox, HERE এবং OpenRouteService, কিন্তু MapAtlas Google এর সবচেয়ে কাছের request/response format দেয় বলে migration effort কমে।
আমি কি ধীরে ধীরে migrate করতে পারি নাকি সব একসাথে switch করতে হবে?
আপনি ধীরে ধীরে migrate করতে পারবেন। প্রতিটি deprecated service স্বাধীন, তাই প্রথমে DirectionsService, তারপর DistanceMatrixService, তারপর visualization libraries বদলাতে পারবেন। এটাই recommended approach কারণ এভাবে পরেরটায় যাওয়ার আগে প্রতিটি replacement আলাদা করে test করা যায়।
MapAtlas কি Google DirectionsService এর মতো একই waypoints এবং travel modes support করে?
হ্যাঁ। MapAtlas Directions API driving, walking এবং cycling travel modes এর পাশাপাশি intermediate waypoints support করে। Request format সামান্য আলাদা (RESTful endpoint বনাম JavaScript class), কিন্তু core functionality, travel mode selection সহ multi-stop routing, সমমানের।

