Roads API の概要
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Roads API は、地図上の 1 つ以上のポイントの緯度と経度の座標を含む HTTPS リクエストを受け付けるサービスです。これらのポイントを使用して付近の道路セグメントを検索し、最寄りの道路セグメントや制限速度などのメタデータとともに場所 ID を返します。
Roads API を使用する理由
Roads API を使用すると、制限速度、到着予定時刻、その他の道路メタデータを取得できます。この道路メタデータを使用すると、次の機能でドライブ アプリを強化できます。
- 緯度と経度の座標を道路に接続します。
- 一連の座標から最も近い道路を特定する
- 道路区間の制限速度を取得する
Roads API でできること
Roads API を使用すると、GPS 座標を道路のジオメトリにマッピングし、道路セグメントに沿った速度制限を特定できます。
- 道路にスナップ: このサービスは、指定された GPS 座標のセットに基づいて、走行した可能性が最も高い道路を返します。ルートに沿って収集された GPS 地点を最大 100 個まで指定できます。必要に応じて、サービスに追加のポイントを補間するようリクエストすることもできます。これにより、道路のジオメトリに沿ってスムーズに移動するパスが生成されます。
- Nearest Roads: このサービスは、GPS ポイントに最も近い道路区分を返します。最大 100 個の GPS ポイントを指定できます。指定するポイントは連続したパスの一部である必要はありません。
- 制限速度 このサービスは、道路区間の掲示された制限速度を返します。速度制限サービスは、アセット管理ライセンスをお持ちのすべてのお客様にご利用いただけます。Google Maps Platform プレミアム プランから従量課金制に移行したお客様は、引き続きこの機能をご利用いただけます。
Roads API の仕組み
Roads API は、緯度/経度座標またはプレイス ID を受け入れて道路のパス、セグメント、制限速度データを提供する 3 つのエンドポイントを使用します。次の例は、一連の緯度/経度座標に基づいて最寄りの道路をリクエストしています。
https://roads.googleapis.com/v1/nearestRoads
?points=60.170880%2C24.942795%7C60.170879%2C24.942796%7C60.170877%2C24.942796
&key=YOUR_API_KEY
リソース
次の表に、Roads API で使用可能なリソースと、返されるデータをまとめます。
データ リソース |
返されたデータ |
戻り値の形式 |
道路にスナップ
|
ルートから最大 100 個の GPS 地点の配列を返します。道路にスナップされた経度と緯度の座標とプレイス ID が含まれます。詳しくは、道路にスナップ ガイドのレスポンスをご覧ください。
|
|
Nearest roads
|
最大 100 個の独立した緯度/経度座標の配列と、指定された各地点の最寄りの道路のプレイス ID。ポイントは連続している必要はありません。詳しくは、最寄りの道路ガイドの回答をご覧ください。
|
制限速度
|
最大 100 個の道路メタデータ要素の配列。これらには、制限速度と場所 ID が含まれており、単位は KPH または MPH です。詳しくは、制限速度ガイドのレスポンスをご覧ください。
|
Roads API の使用方法
1 |
道路へのスナップ デモを試す |
デモをクリックしてトラックを作成し、道路へのスナップ エンドポイントがスムーズなデータを提供する方法を確認します。道路にスナップ ガイドのデモをご覧ください。API キーは必要ありません。 |
2 |
セットアップする |
Google Cloud プロジェクトを設定するから始め、以降の設定手順を完了してから、API キーの使用方法を確認します。 |
3 |
道路へのスナップ リクエストを試す |
道路にスナップする例のいずれかを使用し、ユースケースに関連するものを試してください。 |
4 |
道路の経路の制限速度を取得する |
道路へのスナップ リクエストで指定した同じパスデータを使用して、制限速度クエリを発行します。パスを使用したリクエストの例をご覧ください。 |
5 |
長いパスを処理する方法について |
高度なコンセプト ガイドの長いパスの処理のセクションを参照してください。 |
6 |
道路データをアプリに組み込もう! |
道路スナップ デモの詳細なコード例を参照して、独自のアプリに道路データ機能を組み込むことから始めましょう。 |
利用可能なクライアント ライブラリ
次のいずれかのクライアント ライブラリを使用して、選択した言語でこの API を呼び出します。
Google マップ サービス向けの Java クライアント、Python クライアント、Go クライアント、Node.js クライアントは、コミュニティがサポートするクライアント ライブラリであり、Apache 2.0 ライセンスの下でオープンソース化されています。GitHub からダウンロードできます。インストール手順とサンプルコードも GitHub で確認できます。
次のステップ
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-31 UTC。
[null,null,["最終更新日 2025-08-31 UTC。"],[[["\u003cp\u003eThe Roads API enhances maps applications by connecting coordinates with roads, finding nearby roads, and providing speed limit data.\u003c/p\u003e\n"],["\u003cp\u003eIt offers three core functionalities: snapping GPS points to roads, identifying nearest roads, and retrieving speed limits.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can leverage client libraries for Java, Python, Go, and Node.js to integrate the Roads API.\u003c/p\u003e\n"],["\u003cp\u003eThe API accepts latitude/longitude coordinates and returns data like Place IDs, road segments, and speed limits in JSON format.\u003c/p\u003e\n"],["\u003cp\u003eYou can get started by exploring the documentation, trying the demo, setting up a Google Cloud project, and experimenting with code examples.\u003c/p\u003e\n"]]],["The Roads API processes HTTPS requests with latitude/longitude coordinates to identify nearby road segments. It offers three main services: Snap to Roads, which maps up to 100 GPS points to road geometry; Nearest Roads, which identifies the closest road segment for up to 100 independent GPS points; and Speed Limits, which returns posted speed limits and place IDs for road segments. Users can integrate these functionalities using client libraries or by making direct requests with an API key.\n"],null,["# Roads API overview\n\nThe Roads API is a service that accepts HTTPS requests with latitude/longitude coordinates for one or more points on a map. It uses these points to find nearby road segments and returns a Place ID along with metadata such as the nearest road segment and speed limits.\n\nWhy use the Roads API\n---------------------\n\nWith the Roads API, you can get speed limits, estimated\narrival times, or other road metadata. With this road\nmetadata, you can enhance your driving apps with the follow capabilities:\n\n- Connect latitude/longitude coordinates with a road or roads.\n- Find the nearest road for a set of coordinates\n- Get speed limits for road segments\n\nWhat you can do with the Roads API\n----------------------------------\n\nWith the Roads API, you can map GPS coordinates to the\ngeometry of the road, and determine the speed limit along road\nsegments.\n\n- **[Snap to Roads](/maps/documentation/roads/snap)** This service returns the most likely roads traveled based on the provided set of GPS coordinates. You can specify up to 100 GPS points collected along a route. Optionally, you can also request that the service interpolates additional points, resulting in a path that smoothly follows the geometry of the road.\n- **[Nearest Roads](/maps/documentation/roads/nearest)** This service returns the nearest road segment for a GPS point. You can specify up to 100 GPS points. The points you specify don't need to be part of a continuous path.\n- **[Speed limits](/maps/documentation/roads/speed-limits)** This service returns the posted speed limit for a road segment. The Speed Limit service is available to all customers with an Asset Tracking license. For [Google Maps Platform Premium Plan](/maps/premium) customers who transitioned to pay-as-you-go pricing, the feature remains active.\n\nHow the Roads API works\n-----------------------\n\nThe Roads API uses three endpoints which accept latitude/longitude\ncoordinates or place IDs to provide road paths, segments, or speed limit data.\nThe following example shows a request for nearest roads based on a set\nof latitude/longitude coordinates: \n\n```scdoc\nhttps://roads.googleapis.com/v1/nearestRoads\n ?points=60.170880%2C24.942795%7C60.170879%2C24.942796%7C60.170877%2C24.942796\n &key=YOUR_API_KEY\n```\n\n### Resources\n\nThe following table summarizes the resources available through the\nRoads API along with the data it returns.\n\n\u003cbr /\u003e\n\n| Data resources | Data returned | Return format |\n|------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|\n| **[Snap to roads](/maps/documentation/roads/snap)** | Returns an array of up to 100 GPS points from a route. Includes road-snapped longitude/latitude coordinates along with place IDs. See details in [Responses](/maps/documentation/roads/snap#responses) in the Snap to roads guide. | - JSON |\n| **[Nearest roads](/maps/documentation/roads/nearest)** | An array of up to 100 independent latitude/longitude coordinates along with place IDs for the nearest road for each specified point. Points do not need to be continuous. See details in [Responses](/maps/documentation/roads/nearest#responses) in the Nearest roads guide. | - JSON |\n| **[Speed limits](/maps/documentation/roads/speed-limits)** | An array of up to 100 road metadata elements. These contain speed limits and place IDs, with units either in KPH or MPH. See details in [Responses](/maps/documentation/roads/nearest#responses) in the Speed limits guide. | - JSON |\n\n\u003cbr /\u003e\n\nHow to use the Roads API\n------------------------\n\n|---|----------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1 | **Try the snap to roads demo** | Click the demo to create a track and see how the snap to roads endpoint provides smooth data. See [Demo](/maps/documentation/roads/snap#demo) in the **Snap to roads** guide. You don't need an API key. |\n| 2 | **Get set up** | Start with [Set up your Google Cloud project](/maps/documentation/roads/cloud-setup) and complete the setup instructions that follow and then learn [how to use your API key](/maps/documentation/roads/get-api-key). |\n| 3 | **Try a snap to roads request** | [Use one of the snap to roads examples](/maps/documentation/roads/snap#examples) and try one relevant to your use case. |\n| 4 | **Get speed limits for your road path** | Using the same path data you provided for your snap to roads request, issue a speed limit query. See the [Example request using a path](/maps/documentation/roads/speed-limits#example_request_using_a_path). |\n| 5 | **Learn how to process long paths** | Follow the sections on [Processing long paths](/maps/documentation/roads/advanced#processing_long_paths) in the **Advanced concepts** guide. |\n| 6 | **Incorporate road data into your own app!** | See the [detailed code example](/maps/documentation/roads/snap#javascript-+-html) from the road snapped demo to start building road data functionality into your own app. |\n\n### Available client libraries\n\nCall this API in the language of\nyour choice through one of the following client libraries:\n\n- [Java\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-java)\n- [Python\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-python)\n- [Go Client\n for Google Maps Services](https://github.com/googlemaps/google-maps-services-go)\n- [Node.js\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-js)\n\nThe Java Client, Python Client, Go Client and Node.js Client for Google Maps\nServices are community-supported client libraries, open sourced under the\n[Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0).\nDownload them from GitHub, where you can also find installation instructions and sample code.\n\nWhat's next\n-----------\n\n- **Try out the Roads API** : Go to [Roads Inspector](/maps/documentation/roads/inspector)\n- **Learn how to make Roads API requests** : Go to the service you're interested in:\n - [Snap to roads](/maps/documentation/roads/snap)\n - [Nearest roads](/maps/documentation/roads/nearest)\n - [Speed limits](/maps/documentation/roads/speed-limits)\n- **Understand Advanced Concepts** : Go to [Advanced Concepts](/maps/documentation/roads/advanced)\n- **Follow best practices** : Go to [Web Services Best Practices](/maps/documentation/roads/web-service-best-practices)"]]