Skip to main content
Google Maps API Deprecations मई 2026 में लागू होंगे: Developer
Guides

Google Maps API Deprecations मई 2026 में लागू होंगे: Developer

DirectionsService, DistanceMatrixService, Heatmap Layer और Drawing Library सभी deprecated हैं। मई 2026 की deadline से पहले पूरी migration checklist

Brent van der Heiden13 min read
#Google Maps API#API Migration#Geocoding#Routing#Developer Guide

Google कई वर्षों से अपना Maps Platform tight कर रहा है, लेकिन मई 2026 की deprecation wave अब तक की सबसे disruptive है। Maps JavaScript API से चार widely used features हटाई जा रही हैं: Heatmap Layer, Drawing Library, DirectionsService, और DistanceMatrixService। अगर आपका application इनमें से किसी पर depend करता है, तो code काम करना बंद करने से पहले migrate करने के लिए आपके पास कुछ ही हफ्ते हैं।

यह कोई soft deprecation नहीं है जहां पुराने endpoints सालों तक चलते रहें। Google ने hard removal dates set की हैं, और developer console पहले से ही warnings दिखा रहा है। यह guide exactly बताती है कि क्या बदल रहा है, Google यह changes क्यों कर रहा है, और working code examples के साथ हर service को कैसे migrate करें। अगर आपको drop-in replacement चाहिए, तो हम दिखाएंगे कि MapAtlas APIs हर deprecated Google service से कैसे match करती हैं।

क्या Deprecated हो रहा है और कब

Affected services की पूरी timeline:

ServiceDeprecatedRemoval DateReplacement (Google)
Heatmap Layer (Maps JS API)अगस्त 2025मई 2026Maps Datasets API + deck.gl
Drawing Library (Maps JS API)मई 2025मई 2026Extended Component Library
DirectionsService (Maps JS API)25 फरवरी 2026मई 2026Routes API (REST)
DistanceMatrixService (Maps JS API)25 फरवरी 2026मई 2026Routes API (REST)

एक critical detail: Google routing और distance calculations को पूरी तरह नहीं हटा रहा। वह JavaScript client-side classes हटा रहा है जो developers एक दशक से ज्यादा समय से use करते आए हैं, और newer Routes API पर migration force कर रहा है जो server-side REST endpoint है। यह simple version bump नहीं है। यह एक architectural change है जो 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 errors throw करेंगे। कोई fallback behavior नहीं, कोई graceful degradation नहीं। Map load होगा, लेकिन इन classes पर depend करने वाला कोई भी feature पूरी तरह break हो जाएगा।

Google ये Changes क्यों Force कर रहा है

Google का stated rationale performance और modernization है। Routes API, जो DirectionsService और DistanceMatrixService का replacement है, newer features support करती है जैसे eco-friendly routing, two-wheeled vehicle routing, और toll cost estimation जो legacy JavaScript classes accommodate नहीं कर सकती थीं।

असली driver pricing control है। Routing को server-side REST API पर move करके, Google finer-grained billing और usage tracking पाता है। JavaScript DirectionsService ने client-side batching patterns allow किए थे जिन्हें Google accurately meter करना मुश्किल था। Routes API ensure करती है कि हर request एक metered endpoint से गुजरे।

Heatmap Layer और Drawing Library के लिए, Google developers को उसकी Extended Component Library और third-party visualization tools जैसे deck.gl की तरफ push कर रहा है। यह एक broader pattern का हिस्सा है: Google core map tile rendering in-house रखता है और बाकी सब ecosystem को outsource करता है।

Developers के लिए practical impact है अधिक backend infrastructure, manage करने के लिए अधिक API keys, और ज्यादातर cases में new pricing tiers पर per request higher costs।

Migration Checklist

कोई भी migration code लिखने से पहले, इस checklist से गुजरें:

1. 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 का use करने वाली हर file और component document करें। Note करें कि calls client-side (browser) में होती हैं या server-rendered context में, जैसे Next.js API routes।

2. Usage Patterns Identify करें

हर usage के लिए 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)

3. Migration Target चुनें

दो options हैं:

Option A: Google के साथ रहें। Deprecated JavaScript classes से नई Google Routes API (REST) पर migrate करें। इसके लिए backend changes, new API key permissions, और updated billing चाहिए।

Option B: Provider बदलें। Third-party routing API पर migrate करें। चूंकि integration code वैसे भी rewrite करना है, alternatives evaluate करने का यह सही समय है।

4. Parallel Environment Set Up करें

कभी भी in-place migrate न करें। कम से कम दो हफ्ते तक old और new implementations को side by side चलाएं, cutover से पहले accuracy और latency के results compare करें।

5. 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;
}

Key differences:

  • JavaScript class की जगह REST endpoint। Calls browser नहीं, आपके backend से जाती हैं।
  • Simpler authentication। Query string या header में एक API key।
  • Same response structure। Routes, legs, distance, duration, और polyline सब present हैं।

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 लगभग identical है। Main change callback-based browser API से promise-based server API पर जाना है।

Heatmap Layer Replacement

Heatmap visualization के लिए, migration path आपकी requirements पर depend करती है:

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 पर full control देता है और Google के tile servers पर depend नहीं करता।

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

दोनों options काम करते हैं। MapLibre GL JS MapAtlas tile styles के साथ cleanly integrate होती है, जबकि deck.gl किसी भी base map पर overlay हो सकती है।

Cost Comparison: Google Routes API vs. MapAtlas

Google के Routes API पर migrate करना सिर्फ code change नहीं है। इसके साथ new pricing भी आती है:

ServiceGoogle (legacy, per 1,000)Google Routes API (per 1,000)MapAtlas (per 1,000)
Directions (basic)$5.00$5.00$1.50
Directions (advanced, waypoints/traffic)$10.00$10.00$2.50
Distance Matrix (per element)$5.00$5.00$1.00
Distance Matrix (advanced)$10.00$10.00$2.00
Geocoding$5.00$5.00$1.50

100,000 routing requests per month पर:

  • Google Routes API: लगभग $500-$1,000 (features used पर depend)
  • MapAtlas Directions API: लगभग $150-$250

उन applications के लिए savings जल्दी compound होती हैं जो routing को geocoding और distance calculations के साथ combine करती हैं। एक logistics platform जो 500,000 matrix elements per month process करती है वह Google पर roughly $2,500 vs MapAtlas पर $500 pay करेगी।

Full pricing details के लिए MapAtlas pricing देखें।

Code Migration Examples: Full Before/After

एक React component के लिए complete 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: दोनों APIs Parallel में Run करें

Cutover से दो हफ्ते पहले, हर request के लिए old Google service और new 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 use करें। इससे problems आने पर instantly 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 करें:

  • New API से HTTP 4xx/5xx error rates
  • Latency increases (नया provider अलग response times रख सकता है)
  • Responses में missing fields जिन पर आपकी UI depend करती है
  • Edge cases के लिए route accuracy (ferry routes, toll roads, restricted areas)

Step 4: Go-Live से पहले Load Test करें

अगर application spikes handle करती है, जैसे morning dispatch के दौरान logistics platform, तो नई API को 2x peak volume पर load test करें। MapAtlas production billing के बिना load testing के लिए sandbox environment provide करता है।

Timeline: इस हफ्ते क्या करें

अगर अभी तक migrate करना शुरू नहीं किया, तो priority order यह है:

  1. इस हफ्ते: Codebase audit करें। चार deprecated services के हर usage को identify करें।
  2. Week 2: MapAtlas account बनाएं और API keys लें। Free tier testing के लिए 10,000 requests cover करता है।
  3. Week 3: सबसे critical service का replacement implement करें, आमतौर पर DirectionsService।
  4. Week 4: बाकी services migrate करें और parallel testing run करें।
  5. मई deadline से पहले: Cut over करें, Google API dependencies remove करें, billing update करें।

Migration optional नहीं है। मई 2026 के बाद, deprecated classes Maps JavaScript API से remove हो जाएंगी, और उन्हें reference करने वाला कोई भी code runtime errors throw करेगा। अभी शुरू करें और properly test करने का समय मिलेगा। आखिरी हफ्ते तक रुकें और pressure में production patch करना होगा।

Migration support के लिए, MapAtlas direct developer assistance provide करता है। Contact page के जरिए reach out करें या अपनी requirements के अनुसार replacement APIs evaluate करने के लिए API documentation से शुरू करें।

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

Google Maps API deprecations ठीक कब लागू होते हैं?

Heatmap Layer और Drawing Library को क्रमशः अगस्त और मई 2025 में deprecated किया गया था, और मई 2026 में removal scheduled है। DirectionsService और DistanceMatrixService को 25 फरवरी 2026 को deprecated किया गया, और इनकी भी removal target date मई 2026 है। Removal के बाद, इन services को API calls करने पर errors आएंगी।

क्या मेरी existing Google Maps JavaScript API key मई 2026 के बाद भी काम करेगी?

आपकी API key non-deprecated services के लिए काम करती रहेगी। हालांकि, Maps JavaScript API के जरिए DirectionsService, DistanceMatrixService, Heatmap Layer, या Drawing Library को call करने वाला कोई भी code काम करना बंद कर देगा। Deadline से पहले इन specific calls को replacement APIs पर migrate करना जरूरी है।

Google Maps Directions API का सबसे सस्ता alternative क्या है?

MapAtlas एक Directions API offer करता है जो Google के equivalent से लगभग 70% सस्ता है। Free tier में monthly 10,000 requests शामिल हैं, जो migration develop और test करने के लिए पर्याप्त है। अन्य alternatives में Mapbox, HERE, और OpenRouteService शामिल हैं, लेकिन MapAtlas Google के सबसे करीब request/response format provide करता है जिससे migration effort कम होती है।

क्या मैं incrementally migrate कर सकता हूं या सब एक साथ switch करना होगा?

आप incrementally migrate कर सकते हैं। हर deprecated service independent है, इसलिए पहले DirectionsService, फिर DistanceMatrixService, फिर visualization libraries replace कर सकते हैं। यही recommended approach है क्योंकि इससे अगले पर जाने से पहले हर replacement को isolation में test किया जा सकता है।

क्या MapAtlas Google DirectionsService जैसे ही waypoints और travel modes support करता है?

हां। MapAtlas Directions API driving, walking, और cycling travel modes के साथ-साथ intermediate waypoints support करती है। Request format थोड़ा अलग है (RESTful endpoint vs. JavaScript class), लेकिन core functionality, travel mode selection के साथ multi-stop routing, equivalent है।

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

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

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. He writes about geospatial infrastructure, AI search visibility, and how location data powers the products people rely on every day.

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