Skip to main content
Google Maps DrawingManager और बंद होती API: 2026 माइग्रेशन गाइड
Guides

Google Maps DrawingManager और बंद होती API: 2026 माइग्रेशन गाइड

Drawing Library और Heatmap Layer को Maps JavaScript API से हटा दिया गया है। DirectionsService और DistanceMatrixService Legacy हैं और deprecated घोषित हो चुके हैं। मौजूदा स्थिति, तारीखें और विकल्प।

Brent van der Heidenअंतिम अपडेट 13 min read
#Google Maps API#API माइग्रेशन#DrawingManager#DirectionsService#रूटिंग#डेवलपर गाइड

पिछले अठारह महीनों में Google ने Maps JavaScript API के चार बहुत इस्तेमाल होने वाले हिस्सों को deprecated घोषित किया है। इनमें से दो, Heatmap Layer और Drawing Library, मई 2026 से उपलब्ध नहीं हैं। बाकी दो, DirectionsService और DistanceMatrixService, Legacy और deprecated हैं, लेकिन अब भी काम करते हैं और इन्हें बंद करने की कोई तारीख नहीं है।

यह गाइड हर सेवा की मौजूदा स्थिति Google के अपने पेजों के links के साथ बताती है और उन्हें बदलने का तरीका दिखाती है। जहां विकल्प MapAtlas से आता है, वहां code हमारे असली endpoints और response formats इस्तेमाल करता है।

क्या deprecated है और क्या अब भी चलता है

सेवास्थितिमुख्य तारीखेंGoogle का विकल्प
Heatmap Layerहटा दी गई27 मई 2025 को deprecated, संस्करण 3.65.1c (20 मई 2026) में बंदdeck.gl जैसी third-party libraries
Drawing Library (DrawingManager)हटा दी गईअगस्त 2025 में deprecated, मई 2026 से उपलब्ध नहीं (संस्करण 3.65.3b, 4 जून 2026 में पुष्टि)Terra Draw जैसी third-party libraries
DirectionsServiceLegacy, deprecated1 मार्च 2025 से Legacy, 25 फरवरी 2026 से deprecated (संस्करण 3.64.2b), बंद करने की कोई तारीख नहींRoutes library की Route class
DistanceMatrixServiceLegacy, deprecated1 मार्च 2025 से Legacy, 25 फरवरी 2026 से deprecated (संस्करण 3.64.2b), बंद करने की कोई तारीख नहींRoutes library की RouteMatrix class

स्रोत: Google Maps Platform deprecations पेज, Maps JavaScript API release notes और Legacy products पेज।

Legacy का एक तय अर्थ है। Google के अनुसार Legacy सेवा में नए features नहीं जुड़ते और उसे नए Cloud projects में चालू नहीं किया जा सकता, लेकिन मौजूदा projects में support जारी रहता है। Google ऐसी सेवा बंद करने से कम से कम 12 महीने पहले सूचना देने का वादा करता है, और DirectionsService और DistanceMatrixService को deprecated घोषित करने वाला release note कहता है कि इन्हें बंद करने की योजना नहीं है और गंभीर regressions ठीक किए जाते रहेंगे। 1 मार्च 2025 के इसी Legacy बदलाव में Directions API और Distance Matrix API web services, Places API और JavaScript Places Service भी शामिल थे।

क्या टूटता है

यह code Maps JavaScript API के मौजूदा संस्करणों में अभी fail होता है:

// Removed in 2026: these constructors no longer work
const heatmap = new google.maps.visualization.HeatmapLayer({ data: points });
const drawingManager = new google.maps.drawing.DrawingManager();

यह code मौजूदा projects में अब भी चलता है, लेकिन deprecated है और नए Cloud project में काम नहीं करेगा:

// Legacy and deprecated, no shutdown date yet
const directionsService = new google.maps.DirectionsService();
const distanceMatrixService = new google.maps.DistanceMatrixService();

अगर आपकी साइट पर कोई heatmap या drawing tool मई 2026 में काम करना बंद कर गया, तो वजह यही है। पहले उसे ठीक करें। उसके बाद, Google कोई तारीख घोषित करे उससे पहले routing माइग्रेशन की योजना बनाएं।

Google के विकल्प

Routing के लिए Google दो रास्ते देता है, और कोई भी आपको logic server पर ले जाने के लिए मजबूर नहीं करता:

  • Browser में: Maps JavaScript API की Routes library। Route class, DirectionsService की जगह लेती है और RouteMatrix class, DistanceMatrixService की।
  • Server पर: Routes API, जो Compute Routes और Compute Route Matrix methods वाली एक REST सेवा है।

Visualisation के लिए Google अब अपना कोई विकल्प नहीं देता। उसका heatmap पेज deck.gl की ओर भेजता है, और deprecations पेज drawing के लिए Terra Draw का नाम लेता है।

माइग्रेशन checklist

1. अपने codebase की जांच करें

प्रभावित classes खोजें:

# Find all files using deprecated Google Maps services
grep -rn "DirectionsService\|DistanceMatrixService\|DirectionsRenderer\|HeatmapLayer\|DrawingManager" \
  --include="*.js" --include="*.ts" --include="*.tsx" --include="*.jsx" src/

इन्हें इस्तेमाल करने वाली हर file और component दर्ज करें, और यह भी कि हर call browser में चलती है या server पर।

2. हर सेवा का इस्तेमाल दर्ज करें

हर इस्तेमाल के लिए लिखें:

  • यात्रा के साधन (कार, पैदल, साइकिल, सार्वजनिक परिवहन)
  • बीच के पड़ाव (सीधे A से B, या कई stops वाले routes)
  • पढ़े जाने वाले response fields (दूरी, समय, polyline, steps, किराया)
  • मात्रा (प्रति दिन और प्रति महीने requests, लागत के अनुमान के लिए)
  • Latency की जरूरत (users के लिए real-time, या batch)

3. लक्ष्य चुनें

विकल्प A: Google के साथ रहें। Route और RouteMatrix classes या Routes API पर जाएं। जिन fields का आप इस्तेमाल करते हैं उन्हें migration guides से मिलाएं, क्योंकि response formats Legacy classes से अलग हैं।

विकल्प B: provider बदलें। Integration तो वैसे भी दोबारा लिखना है, इसलिए step 2 की जरूरतों के आधार पर providers की तुलना करें।

4. पुराना और नया साथ-साथ चलाएं

सीधे जगह पर माइग्रेट न करें। कुछ समय तक दोनों implementations साथ चलाएं और switch करने से पहले अपने असली routes पर दूरी, समय और latency की तुलना करें।

5. Error handling अपडेट करें

Legacy classes callback में status value के जरिए errors बताती थीं। REST विकल्प HTTP status codes और error bodies लौटाते हैं, इसलिए आपका error handling भी बदलना होगा।

हर सेवा को MapAtlas से बदलना

MapAtlas के routing endpoints gateway.mapmetrics-atlas.net पर चलने वाली REST सेवाएं हैं, जिनका विवरण MapAtlas API docs में है। ये token को query parameter के रूप में लेते हैं, इसलिए इन्हें अपने backend से call करें।

DirectionsService से MapAtlas Directions API तक

पहले (Google, Legacy):

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://gateway.mapmetrics-atlas.net/directions/?token=${process.env.MAPATLAS_API_KEY}`,
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      // Ordered stops: origin, waypoints, destination
      locations: [
        { lat: 52.52, lon: 13.405 },
        { lat: 50.9375, lon: 6.9603 },
        { lat: 48.8566, lon: 2.3522 },
      ],
      costing: "auto", // auto, bicycle, pedestrian, bus, truck, taxi, motor_scooter
      units: "kilometers",
    }),
  }
);

const { trip } = await response.json();
console.log("Distance (km):", trip.summary.length);
console.log("Duration (s):", trip.summary.time);
// Each leg carries its geometry as an encoded polyline (precision 6)
const shapes = trip.legs.map((leg) => leg.shape);

मुख्य अंतर:

  • JavaScript class की जगह REST call, जो आपके backend से होती है।
  • बीच के पड़ाव locations की बीच वाली entries हैं।
  • Response का ढांचा अलग है। कुल आंकड़े trip.summary में हैं, और हर हिस्से के shape में encoded polyline है। Route बनाने से पहले उसे decode करें (नीचे backend का उदाहरण देखें)।

DistanceMatrixService से MapAtlas Matrix API तक

MapAtlas Matrix API एक ही call में हर origin और destination जोड़ी का यात्रा समय और दूरी लौटाता है। हमारा endpoint हर जोड़ी को 400 km route दूरी तक सीमित रखता है, इसलिए उदाहरण में बर्लिन के आसपास की जगहें ली गई हैं।

पहले (Google, Legacy):

const service = new google.maps.DistanceMatrixService();

service.getDistanceMatrix(
  {
    origins: [
      { lat: 52.52, lng: 13.405 },
      { lat: 52.3906, lng: 13.0645 },
    ],
    destinations: [
      { lat: 51.3397, lng: 12.3731 },
      { lat: 51.0504, lng: 13.7373 },
    ],
    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://gateway.mapmetrics-atlas.net/matrix/?token=${process.env.MAPATLAS_API_KEY}`,
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      sources: [
        { lat: 52.52, lon: 13.405 },
        { lat: 52.3906, lon: 13.0645 },
      ],
      targets: [
        { lat: 51.3397, lon: 12.3731 },
        { lat: 51.0504, lon: 13.7373 },
      ],
      costing: "auto",
      units: "kilometers",
    }),
  }
);

const data = await response.json();

// One row per source, one cell per target
data.sources_to_targets.forEach((row: any[], i: number) => {
  row.forEach((cell, j) => {
    console.log(`Origin ${i} -> Dest ${j}:`, cell.distance, "km", cell.time, "s");
  });
});

यह grid Google के rows और elements जैसा ही है। दूरी आपकी मांगी गई इकाई में संख्या के रूप में और समय seconds में आता है, इसलिए formatting आपको खुद करनी होगी।

Heatmap Layer का विकल्प

विकल्प 1: MapLibre GL JS में heatmap layer (open source)

import maplibregl from "maplibre-gl";

const map = new maplibregl.Map({
  container: "map",
  style: "https://gateway.mapmetrics-atlas.net/styles/?fileName=YOUR_ACCOUNT_ID/mapstyle.json&token=YOUR_API_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 खुद map library में render होता है, किसी अतिरिक्त सेवा के बिना।

विकल्प 2: deck.gl का HeatmapLayer, जिसे Google का documentation सुझाता है:

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,
});

दोनों काम करते हैं। MapLibre GL JS सीधे MapAtlas styles पढ़ता है, और deck.gl किसी भी base map के ऊपर रखा जा सकता है।

Drawing Library का विकल्प

DrawingManager से users map पर markers, lines, circles और polygons बना सकते थे। Terra Draw, जिसका नाम Google का deprecations पेज लेता है, वही modes देता है और कई map libraries के लिए adapters रखता है, जिनमें Google Maps और MapLibre GL JS शामिल हैं। बनाई गई आकृतियां GeoJSON में लौटती हैं, जिन्हें आप वैसे ही store कर सकते हैं या किसी geofencing या isochrone सेवा को भेज सकते हैं।

लागत की तुलना

Routing के Legacy SKUs और उनकी जगह आने वाले Essentials SKUs के लिए Google की list prices एक जैसी हैं। नीचे की सभी कीमतें Google Maps Platform pricing पेज और MapAtlas pricing पेज से ली गई हैं, और दोनों 26 सितंबर 2026 को जांची गईं।

सेवाGoogle, हर महीने मुफ्तGoogle, उसके बाद प्रति 1,000 (पहला स्तर)MapAtlas, हर महीने मुफ्तMapAtlas, उसके बाद प्रति 1,000 (पहला स्तर)
Directions (Legacy) या Compute Routes Essentials10,000$5.001,00,000 navigation requests€1.53
Directions Advanced (Legacy) या Compute Routes Pro5,000$10.00वही navigation स्तर€1.53
Distance Matrix (Legacy) या Compute Route Matrix Essentials10,000 elements$5.00Pricing पेज देखेंPricing पेज देखें
Geocoding10,000$5.0025,000€3.90

Google अमेरिकी डॉलर में और MapAtlas यूरो में बिल करता है, इसलिए तुलना से पहले मुद्रा बदल लें। दोनों ज्यादा मात्रा पर कम दर लेते हैं। हर महीने 5,00,000 route requests का एक उदाहरण:

  • Google Compute Routes Essentials: 10,000 मुफ्त, 90,000 पर $5.00 और 4,00,000 पर $4.00, यानी कुल $2,050।
  • MapAtlas navigation: 1,00,000 मुफ्त और 4,00,000 पर €1.53, यानी कुल लगभग €610।

पूरा उदाहरण: backend route और map

इस तरीके में API key server पर रहती है और browser को सिर्फ route की geometry भेजी जाती है।

Backend API route (Next.js)

// app/api/directions/route.ts
import { NextRequest, NextResponse } from "next/server";

// Decode an encoded polyline with precision 6 into [lon, lat] pairs
function decodePolyline6(str: string): [number, number][] {
  const coords: [number, number][] = [];
  let index = 0, lat = 0, lng = 0;
  while (index < str.length) {
    for (const axis of [0, 1]) {
      let result = 0, shift = 0, byte: number;
      do {
        byte = str.charCodeAt(index++) - 63;
        result |= (byte & 0x1f) << shift;
        shift += 5;
      } while (byte >= 0x20);
      const delta = result & 1 ? ~(result >> 1) : result >> 1;
      if (axis === 0) lat += delta; else lng += delta;
    }
    coords.push([lng / 1e6, lat / 1e6]);
  }
  return coords;
}

export async function GET(request: NextRequest) {
  const { searchParams } = new URL(request.url);
  const [oLat, oLon] = searchParams.get("origin")!.split(",").map(Number);
  const [dLat, dLon] = searchParams.get("destination")!.split(",").map(Number);

  const response = await fetch(
    `https://gateway.mapmetrics-atlas.net/directions/?token=${process.env.MAPATLAS_API_KEY}`,
    {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        locations: [{ lat: oLat, lon: oLon }, { lat: dLat, lon: dLon }],
        costing: "auto",
        units: "kilometers",
      }),
    }
  );
  if (!response.ok) {
    return NextResponse.json({ error: "routing failed" }, { status: 502 });
  }

  const { trip } = await response.json();
  const coordinates = trip.legs.flatMap((leg: { shape: string }) => decodePolyline6(leg.shape));
  return NextResponse.json({
    coordinates,
    distanceKm: trip.summary.length,
    durationS: trip.summary.time,
  });
}

Map component (React और 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://gateway.mapmetrics-atlas.net/styles/?fileName=YOUR_ACCOUNT_ID/mapstyle.json&token=YOUR_API_KEY",
      center: [origin.lng, origin.lat],
      zoom: 7,
    });

    map.on("load", async () => {
      const res = await fetch(
        "/api/directions?" +
          new URLSearchParams({
            origin: `${origin.lat},${origin.lng}`,
            destination: `${destination.lat},${destination.lng}`,
          })
      );
      if (!res.ok) return;
      const { coordinates } = await res.json();

      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 },
      });

      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" }} />;
}

माइग्रेशन की जांच कैसे करें

Step 1: दोनों implementations की तुलना करें

Test अवधि में एक ही requests के साथ पुरानी और नई दोनों सेवाओं को call करें। दोनों की दूरी और समय log करें और अपने असली routes पर अंतर देखें, खासकर ferry, toll और प्रतिबंधित सड़कों पर।

Step 2: feature flag इस्तेमाल करें

Provider को एक flag के पीछे रखें ताकि बिना deploy के वापस जा सकें:

const useMapAtlasDirections = process.env.FEATURE_MAPATLAS_DIRECTIONS === "true";

const directions = useMapAtlasDirections
  ? await fetchMapAtlasDirections(origin, destination)
  : await fetchGoogleDirections(origin, destination);

Step 3: error दरों पर नजर रखें

Switch के बाद इन पर नजर रखें:

  • नई API से HTTP 4xx और 5xx दरें
  • Latency में बदलाव
  • आपका UI जिन्हें पढ़ता है, ऐसे गायब fields
  • Ferry, toll roads और प्रतिबंधित क्षेत्रों जैसे खास मामलों में route के अंतर

Step 4: go-live से पहले load test

अगर आपके traffic में peaks आते हैं, जैसे किसी logistics platform पर सुबह के dispatch के समय, तो नई API पर निर्भर होने से पहले उसे अपने peak volume के दोगुने पर load test करें।

अभी क्या करें

  1. अगर आप अब भी Heatmap Layer या Drawing Library load करते हैं: पहले इन्हें बदलें। Maps JavaScript API के मौजूदा संस्करणों में ये अब काम नहीं करतीं।
  2. Routing code की जांच करें: DirectionsService, DirectionsRenderer और DistanceMatrixService की हर call खोजें।
  3. विकल्प चुनें: Route और RouteMatrix classes, Routes API, या कोई दूसरा provider।
  4. एक समय में एक सेवा माइग्रेट करें, feature flag के पीछे, और switch से पहले नतीजों की तुलना करें।
  5. Google के deprecations पेज पर नजर रखें ताकि बंद होने की तारीख आए तो पता चले। Google ने Legacy सेवाओं के लिए कम से कम 12 महीने पहले सूचना देने का वादा किया है।

MapAtlas की routing APIs आजमाने के लिए मुफ्त account बनाएं और API documentation पढ़ें। माइग्रेशन में मदद के लिए contact पेज इस्तेमाल करें।

अक्सर पूछे जाने वाले प्रश्न

क्या Google Maps की Drawing Library अब भी उपलब्ध है?

नहीं। Google ने DrawingManager समेत Drawing Library को अगस्त 2025 में deprecated घोषित किया, और उसका deprecations पेज बताता है कि यह मई 2026 से उपलब्ध नहीं है। Maps JavaScript API के संस्करण 3.65.3b (4 जून 2026) के release notes पुष्टि करते हैं कि DrawingManager अब उपलब्ध नहीं है। Google विकल्प के रूप में Terra Draw का नाम लेता है।

क्या Heatmap Layer अब भी उपलब्ध है?

नहीं। Google ने Heatmap Layer को 27 मई 2025 को deprecated घोषित किया, और 20 मई 2026 के संस्करण 3.65.1c में इसे पूरी तरह बंद बताया गया। Google इसकी जगह deck.gl के HeatmapLayer जैसी third-party libraries सुझाता है।

DirectionsService और DistanceMatrixService कब काम करना बंद करेंगे?

Google ने कोई तारीख तय नहीं की है। दोनों 1 मार्च 2025 से Legacy स्थिति में हैं और 25 फरवरी 2026 से deprecated हैं। Google के release notes के अनुसार इन्हें बंद करने की कोई योजना नहीं है, गंभीर regressions के fix आते रहेंगे, और support खत्म होने से कम से कम 12 महीने पहले सूचना दी जाएगी। Legacy सेवाएं नए Cloud projects में उपलब्ध नहीं हैं, इसलिए नए project को Route और RouteMatrix classes या किसी दूसरे provider की जरूरत होगी।

क्या मैं धीरे-धीरे माइग्रेट कर सकता हूं या सब कुछ एक साथ बदलना होगा?

आप एक समय में एक सेवा माइग्रेट कर सकते हैं। हर deprecated class दूसरी से स्वतंत्र है। पहले Drawing Library और Heatmap Layer बदलें, क्योंकि वे पहले ही काम नहीं कर रहीं, फिर DirectionsService और DistanceMatrixService को अपनी समय-सारिणी के अनुसार बदलें।

क्या MapAtlas बीच के पड़ाव और कई यात्रा साधनों को सपोर्ट करता है?

हां। MapAtlas Directions API स्थानों की एक क्रमबद्ध सूची लेता है, इसलिए पहले और आखिरी के बीच का हर बिंदु एक पड़ाव है। यह auto, bicycle, pedestrian, bus, truck, taxi और motor_scooter costing models को सपोर्ट करता है। यह एक REST endpoint है, इसलिए API key को client तक पहुंचने से रोकने के लिए इसे अपने backend से call करें।

यह उपयोगी लगा? इसे साझा करें।

लेखक के बारे में

Brent van der Heiden

लेखक

Brent van der Heiden

Co-Founder & CEO at MapAtlas

Brent built MapAtlas out of a conviction that developers deserve location APIs with fair pricing and genuine end-user privacy. Before that he co-founded MapMetrics, a community mapping and navigation app. He writes about geospatial infrastructure, map data, AI search visibility, and how location data powers the products people rely on every day.

सभी लेख देखें →
ब्लॉग पर वापस जाएं