ウェブサービスの使用を最適化する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
注: 現在、Google Maps Platform プレミアム プランは、新規お申し込みまたは新規お客様のご利用を受け付けていません。
概要
アプリケーションによる Google Maps Platform ウェブサービスの使用量が上限を超えると、そのサービスからエラー メッセージが返されます。使用量上限を超える状態がその後も続くと、ウェブサービスへのアクセスがブロックされ、場合によっては「403 Forbidden」レスポンスが返されます。
アプリケーションのウェブサービス リクエストでエラー メッセージが表示される場合は、ウェブサービスをより効率的に使用するようにアプリケーションを最適化することで、使用量を低減できます。
始める前に
アプリケーションによるウェブサービスの使用を最適化する前に、ユースケースに応じた適切なサービスと Maps API ライセンスを使用していることをご確認ください。
ユースケースを確認する
Google Maps Platform ウェブサービスは、リアルタイム入力を必要としないアプリケーションに最適です
ブラウザが使用されていない場合や、たとえば、ウェブサーバーは、ウェブサーバーを
アプリケーションで、ユーザー入力とは無関係なデータセット(例: 固定セット、
ジオコーディングする必要がある不動産ウェブサイト上の住所の数。
ウェブサービスの場合、1 分あたりのクエリ数(QPM)の上限は
プレミアム プラン ライセンス(IP アドレスの数に関係なく)
送信元を表します。
一方、Maps JavaScript API で使用できるクライアント側サービスでは、リクエストがすべてのユーザーに分散され、ユーザーの増加に応じて拡張できるようにするため、ブラウザ セッションごとにレート制限が適用されます。したがって、ユーザーの自宅周辺の店舗を検索するなど、ユーザーが入力した住所をリアルタイムでジオコーディングするアプリケーションには、クライアント側サービスが適しています。
ウェブサービスが適しているユースケースについて詳しくは、ジオコーディング時の最適化方法をご覧ください。このドキュメントではジオコーディングの推奨事項に焦点を当てていますが、サーバー側のウェブサービスが適しているケースと、クライアント側の同等の機能が適しているケースについての説明は、あらゆるウェブサービスにあてはまります。
ウェブサービスの使用を最適化する方法
ウェブサービスを効率的に使用するには、必要なときのみリクエストを送信して使用量を減らし、負荷を均等に分散させて、上限を超えないようにする必要があります。
結果をキャッシュする
Google Maps Platform 利用規約の第 3.2.3.a 項および b 項では、利用規約に記載されている例外を除き、コンテンツのプリフェッチ、インデックスへの登録、保管、キャッシュはできないと定められています。
ただし、プレイスを一意に識別するために使用されるプレイス ID は、キャッシング制限の適用対象外のため、無期限で保存できます。
リクエストを絞り込む(スロットリング)
使用制限の超過を避けるため、リクエストの送信日時を監視するキューにリクエストを入れて、リクエストを絞り込むようにアプリケーションを設定できます。アプリケーションで
QPM の上限を超える追加のリクエストを受信する場合は、クエリのペースを調整します。コードで、クエリ間の待機時間として **`S`** 秒を追加します。クエリで引き続き割り当てエラーが発生する場合は、待機時間を 2 倍にしてから別のクエリを送信します。クエリがエラーなしで返されるまで、待機時間の調整を続けます。
スロットリングを行っても、ステータス コード OVER_QUERY_LIMIT
のレスポンスを受け取る可能性があります。このようなレスポンスを受信したら、短時間の遅延(20 ミリ秒)を挿入するようにアプリケーションを設定し、再試行してください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-31 UTC。
[null,null,["最終更新日 2025-08-31 UTC。"],[[["\u003cp\u003eThe Google Maps Platform Premium Plan is no longer available for new customers.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Maps Platform web services are best suited for applications with non-real-time data and fixed datasets, like geocoding addresses on a real estate website.\u003c/p\u003e\n"],["\u003cp\u003eClient-side services, like the Maps JavaScript API, are recommended for applications requiring real-time user interaction, such as store locators.\u003c/p\u003e\n"],["\u003cp\u003eOptimize web service usage by caching allowed data like place IDs and throttling requests to stay within usage limits.\u003c/p\u003e\n"],["\u003cp\u003eIf exceeding usage limits, adjust request frequency and incorporate delays to prevent service disruptions and errors.\u003c/p\u003e\n"]]],[],null,["**Important:** The Google Maps Platform Premium Plan is no longer available for\nsign up or new customers.\n\nOverview\n\nIf your application exceeds the usage\nlimits for a Google Maps Platform web service, the service returns an error message. If your\napplication continues to exceed the usage limits, it might be blocked from accessing the\nweb service and, in some cases, receive \"403 Forbidden\" responses.\n\nIf your application's web service requests receive error messages, you can lower usage by\noptimizing applications to use the web services more efficiently.\n\nBefore you begin\n\nBefore optimizing your application's web service usage, check that you're using the correct\nservice for your use case and the correct Maps APIs license.\n\nValidate your use case\n\nGoogle Maps Platform web services are best for applications that don't require real-time input\nfrom users or when a web browser is not used. For example, you should use web services if your\napplication uses a dataset that is independent of user input---for example, a fixed set\nof addresses on a real estate website that needs to be geocoded.\n\nNote that with web services, the queries-per-minute (QPM) limit applies to your\nPremium Plan license, regardless of how many IP addresses\nrequests are sent from.\n\nOn the other hand, the client-side services available with the Maps JavaScript API\nare rate limited per browser session, so that requests are distributed across all your users and\nscale as the number of users grows. Therefore, client-side services are best for applications\nthat geocode address input from users in real time, such as a store locator that searches for\nstores near a user's home address.\n\nFor a more detailed discussion on when to use web services, see [Geocoding\nStrategies](/maps/documentation/geocoding/geocoding-strategies). Although specific to geocoding, the recommendations in this\ndocument apply to all web services, explaining when you should use server-side\nweb services or their client-side equivalents.\n\nHow to optimize web service usage\n\nTo use web services more efficiently, you can lower usage by sending requests only when\nnecessary and spreading usage evenly to keep it under the limits.\n\nCache results\n\nSections [3.2.3.a and b](https://cloud.google.com/maps-platform/terms/#3.-license.)\nof the Google Maps Platform Terms of Service states that you must not pre-fetch, index, store, or cache any Content\nexcept under the limited conditions stated in the Terms.\n\nNote that the **place ID** , used to uniquely identify a place, is **exempt\nfrom** the caching restriction. You can therefore store place ID values indefinitely.\n\nThrottle requests\n\nTo avoid exceeding usage limits, you can configure your application to throttle requests, by\nplacing them in a queue that keeps track of when the requests are sent. If your application\nreceives one additional request beyond the QPM limit, adjust the pace of your queries. In your code, add a waiting period of \\*\\*\\`S\\`\\*\\* seconds between queries. If the query still results in a quota error, double the waiting period and then send another query. Continue adjusting the waiting period until the query returns without an error.\n\nEven with throttling, applications might still receive responses with the status code\n`OVER_QUERY_LIMIT`. Configure your application to insert a small delay (20 ms)\nand try again if it receives such response."]]