Skip to main content
Google Maps API廃止が2026年5月に到来:開発者向け移行チェックリスト
Guides

Google Maps API廃止が2026年5月に到来:開発者向け移行チェックリスト

DirectionsService、DistanceMatrixService、Heatmap Layer、Drawing Libraryがすべて廃止予定です。2026年5月の期限前に完全な移行チェックリスト、代替API、コスト比較をお届けします。

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

GoogleはMaps Platformを長年にわたって強化してきましたが、2026年5月の廃止の波はこれまでで最も影響が大きいものです。Maps JavaScript APIから4つの広く使われている機能が削除されます:Heatmap Layer、Drawing Library、DirectionsService、DistanceMatrixServiceです。アプリケーションがこれらのいずれかに依存している場合、コードが動作しなくなる前に移行できる時間は数週間しかありません。

これは旧エンドポイントが何年も残り続けるような「ソフト廃止」ではありません。Googleは厳格な削除日を設定しており、デベロッパーコンソールにはすでに警告が表示されています。このガイドでは、何が変わるか、なぜGoogleがこの変更を行うのか、そして動作するコード例とともに各サービスをどう移行するかを説明します。ドロップイン代替が必要な方向けに、MapAtlas APIが各廃止Googleサービスにどう対応するかも紹介します。

TL;DR: 廃止される内容と時期

影響を受けるサービスの完全なタイムライン:

サービス廃止発表削除日代替(Google)
Heatmap Layer (Maps JS API)2025年8月2026年5月Maps Datasets API + deck.gl
Drawing Library (Maps JS API)2025年5月2026年5月Extended Component Library
DirectionsService (Maps JS API)2026年2月25日2026年5月Routes API (REST)
DistanceMatrixService (Maps JS API)2026年2月25日2026年5月Routes API (REST)

重要な点:Googleはルーティングや距離計算を完全に廃止するわけではありません。削除されるのはクライアントサイドのJavaScriptクラスで、開発者が10年以上使ってきたものです。新しいRoutes API(サーバーサイドのRESTエンドポイント)への移行が強制されます。単純なバージョンアップではなく、ルーティングロジックをブラウザからバックエンドに移動するアーキテクチャ変更です。

壊れるもの

コードベースに以下のいずれかが含まれている場合、削除日以降に動作しなくなります:

// 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();

削除後、これらのコンストラクタはエラーをスローします。フォールバック動作も、グレースフルデグレデーションもありません。マップはロードされますが、これらのクラスに依存する機能はすべて完全に壊れます。

なぜGoogleはこの変更を強制するのか

Googleの公式の理由はパフォーマンスとモダナイゼーションです。DirectionsServiceとDistanceMatrixServiceの代替であるRoutes APIは、レガシーJavaScriptクラスでは対応できない新機能をサポートしています。エコフレンドリールーティング、二輪車ルーティング、通行料金の見積もりなどです。

実際の理由は価格管理です。ルーティングをサーバーサイドREST APIに移動することで、Googleはより細かい課金と使用量追跡を実現できます。JavaScriptのDirectionsServiceはクライアントサイドのバッチ処理パターンを可能にしており、Googleには正確に計量するのが難しいものでした。Routes APIはすべてのリクエストが計量されたエンドポイントを通過することを保証します。

Heatmap LayerとDrawing Libraryについては、Googleは開発者をExtended Component LibraryやDeck.glなどのサードパーティの可視化ツールに誘導しています。これはより広いパターンの一部です:Googleはコアのマップタイルレンダリングを社内に保持し、それ以外はエコシステムに外部化しています。

開発者への実際の影響:より多くのバックエンドインフラ、管理するAPIキーの増加、そして多くの場合、新しい価格ティアでのリクエストあたりのコスト増加です。

移行チェックリスト

移行コードを書く前に、このチェックリストに沿って作業してください:

1. コードベースの監査

廃止されたクラスへの参照をコードベースで検索します:

# 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/

これらのサービスを使用しているすべてのファイルとコンポーネントを記録してください。呼び出しがクライアントサイド(ブラウザ)で発生しているか、サーバーレンダリングコンテキスト(例:Next.js APIルート)で発生しているかを記録します。

2. 使用パターンの特定

各使用箇所について記録します:

  • 使用している移動モード(車、徒歩、自転車、交通機関)
  • ウェイポイントサポート(シンプルなA→B、またはマルチストップルート)
  • 消費するレスポンスフィールド(距離、時間、ポリライン、ステップ、運賃)
  • ボリューム(コスト見積もりのための1日/月あたりのリクエスト数)
  • レイテンシ要件(ユーザー向けリアルタイム、またはバッチ処理)

3. 移行ターゲットの選択

2つのオプションがあります:

オプションA:Googleに留まる。 廃止されたJavaScriptクラスから新しいGoogle Routes API(REST)に移行します。バックエンドの変更、新しいAPIキーの権限、課金の更新が必要です。

オプションB:プロバイダーを変更する。 サードパーティのルーティングAPIに移行します。どちらにしても統合コードを書き直すため、代替を評価する良い機会です。

4. 並行環境のセットアップ

絶対にインプレースで移行しないでください。切り替える前に、少なくとも2週間、古い実装と新しい実装を並行して実行し、精度とレイテンシの結果を比較してください。

5. エラーハンドリングの更新

廃止されたサービスはコールバック関数でエラーを返していました。REST APIの代替はHTTPステータスコードを返します。それに応じてエラーハンドリングロジックを変更する必要があります。

API別の置き換えガイド

DirectionsServiceからMapAtlas Directions APIへ

移行前(Google、廃止済み):

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クラスの代わりにRESTエンドポイントを使用。呼び出しはブラウザではなくバックエンドから行われます。
  • シンプルな認証。 クエリ文字列またはヘッダーに1つのAPIキー。
  • 同じレスポンス構造。 ルート、レグ、距離、時間、ポリラインがすべて含まれます。

DistanceMatrixServiceからMapAtlas Matrix APIへ

移行前(Google、廃止済み):

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

レスポンスの形状はほぼ同じです。主な変更はコールバックベースのブラウザAPIからPromiseベースのサーバーAPIへの移行です。

Heatmap Layerの置き換え

ヒートマップの可視化については、移行パスは要件によって異なります:

オプション1:MapLibre GL JSとヒートマップレイヤー(オープンソース)

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

ヒートマップレンダリングを完全にコントロールでき、GoogleのタイルサーバーへのI依存がなくなります。

オプション2:deck.gl HeatmapLayer(Google公式推奨)

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

どちらも使えます。MapLibre GL JSはMapAtlasのタイルスタイルとクリーンに統合でき、deck.glはどのベースマップにもオーバーレイできます。

コスト比較:Google Routes API vs. MapAtlas

GoogleのRoutes APIへの移行はコード変更だけではありません。新しい料金体系も伴います:

サービスGoogle(レガシー、1,000件あたり)Google Routes API(1,000件あたり)MapAtlas(1,000件あたり)
Directions(基本)$5.00$5.00$1.50
Directions(高度、ウェイポイント/交通情報)$10.00$10.00$2.50
Distance Matrix(要素あたり)$5.00$5.00$1.00
Distance Matrix(高度)$10.00$10.00$2.00
Geocoding$5.00$5.00$1.50

月間10万件のルーティングリクエストで:

  • Google Routes API: 約$500-$1,000(使用する機能による)
  • MapAtlas Directions API: 約$150-$250

ルーティングとジオコーディング、距離計算を組み合わせるアプリケーションでは節約効果がすぐに積み重なります。月間50万のマトリックス要素を処理するロジスティクスプラットフォームでは、Googleで約$2,500、MapAtlasで$500という違いになります。

詳細な料金についてはMapAtlasの料金ページをご覧ください。

コード移行例:完全な前後比較

マップ上でドライビングルートを表示するReactコンポーネントの完全な移行例です。

移行前: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" }} />;
}

移行後:MapLibre GL JSとMapAtlas Directions API

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

バックエンドAPIルート(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);
}

このパターンでAPIキーをサーバーに保持し、ルートジオメトリのみをクライアントに公開します。

期限前に移行をテストする方法

ステップ1:両方のAPIを並行実行する

切り替えの2週間前から、すべてのリクエストに対して古いGoogleサービスと新しい代替の両方を呼び出します。両方のレスポンスをログに記録して比較します:

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

ステップ2:フィーチャーフラグを設定する

アプリケーションがどのAPIを呼び出すかをフィーチャーフラグで制御します。問題が発生した場合に即座にロールバックできます:

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

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

ステップ3:エラー率を監視する

切り替え後に監視する項目:

  • 新しいAPIからのHTTP 4xx/5xxエラー率
  • レイテンシの増加(新しいプロバイダーはレスポンスタイムが異なる場合があります)
  • UIが依存するレスポンスの欠落フィールド
  • エッジケースのルート精度(フェリールート、有料道路、通行制限区域)

ステップ4:本番環境前にロードテストする

アプリケーションがスパイクを処理する場合(例:朝の配送ディスパッチ時のロジスティクスプラットフォーム)、ピーク量の2倍で新しいAPIをロードテストしてください。MapAtlasは本番課金なしでロードテストできるサンドボックス環境を提供しています。

タイムライン:今週やるべきこと

まだ移行を始めていない場合の優先順位:

  1. 今週: コードベースを監査する。4つの廃止サービスの使用箇所をすべて特定する。
  2. 第2週: MapAtlasアカウントを作成してAPIキーを取得する。無料ティアはテスト用に10,000リクエストをカバーします。
  3. 第3週: 最も重要なサービス(通常はDirectionsService)の代替を実装する。
  4. 第4週: 残りのサービスを移行して並行テストを実施する。
  5. 5月の期限前に: 切り替えを完了し、Google API依存を削除し、課金を更新する。

移行は選択肢ではありません。2026年5月以降、廃止されたクラスはMaps JavaScript APIから削除され、これらを参照するすべてのコードはランタイムエラーをスローします。今すぐ始めれば適切にテストする時間があります。最後の週まで待てば、プレッシャーの下で本番環境にパッチを当てることになります。

移行のサポートについては、MapAtlasが開発者への直接支援を提供しています。お問い合わせページからご連絡いただくか、APIドキュメントから代替APIの評価を始めてください。

よくある質問

Google Maps APIの廃止はいつ正確に有効になりますか?

Heatmap LayerとDrawing Libraryはそれぞれ2025年8月と5月に廃止が発表され、2026年5月に削除が予定されています。DirectionsServiceとDistanceMatrixServiceは2026年2月25日に廃止となり、同じく2026年5月が削除目標です。削除後、これらのサービスへのAPIコールはエラーを返します。

2026年5月以降も既存のGoogle Maps JavaScript APIキーは使えますか?

廃止対象でないサービスにはAPIキーが引き続き使えます。ただし、Maps JavaScript API経由でDirectionsService、DistanceMatrixService、Heatmap Layer、Drawing Libraryを呼び出すコードはすべて動作しなくなります。これらの特定の呼び出しを期限前に代替APIへ移行する必要があります。

Google Maps Directions APIの最安の代替はどこですか?

MapAtlasはGoogleの同等サービスより約70%安いDirections APIを提供しています。無料ティアは月10,000リクエスト含まれており、移行の開発とテストに十分です。他の選択肢としてMapbox、HERE、OpenRouteServiceがありますが、MapAtlasはGoogleに最も近いリクエスト/レスポンス形式を持つため、移行の手間を最小化できます。

段階的に移行できますか?それとも一度に切り替える必要がありますか?

段階的に移行できます。廃止されるサービスはそれぞれ独立しているため、まずDirectionsService、次にDistanceMatrixService、最後にビジュアライゼーションライブラリという順で置き換えられます。この方法が推奨されます。次に進む前に各代替をテストできるためです。

MapAtlasはGoogle DirectionsServiceと同じウェイポイントと移動モードに対応していますか?

はい。MapAtlas Directions APIは車、徒歩、自転車の移動モードと中間ウェイポイントに対応しています。リクエスト形式は少し異なります(RESTful エンドポイント vs. JavaScript クラス)が、コア機能である移動モード選択付きのマルチストップルーティングは同等です。

役に立ちましたか?シェアしてください。

著者について

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.

すべての記事を見る
ブログに戻る