> Documentation index: https://developers.google.com/maps/documentation/llms.txt

The Roads API is an HTTPS web service that takes latitude/longitude coordinates (or, for Speed Limits, road-segment place IDs) and returns the roads a vehicle most likely traveled (Snap to Roads), the nearest road segments (Nearest Roads), and posted speed limits (Speed Limits), with a place ID for each road segment.

## Roads API: key facts

- **Product:** Roads API
- **Also known as:** Google Maps Roads API, Roads API 1.0
- **Category:** Routes
- **Platform:** Web service (REST)
- **Runs on:** Server (backend code)
- **Launch stage:** GA
- **Lifecycle:** Active
- **Overview:** [Roads API overview](https://developers.google.com/maps/documentation/roads/overview.md.txt)

## Roads API: when to use it

**Use Roads API when:**

- You need to snap a sequence of GPS points (up to 100 per request) to the roads a vehicle most likely traveled, optionally interpolating the road geometry.
- You need the nearest road segment and its place ID for independent GPS points that don't form a continuous path.
- You need the posted automobile speed limit for road segments and have an Asset Tracking license (Speed Limits has limited access).

## Roads API: setup

- **Service to enable:** `roads.googleapis.com`
- **Authentication:** API key
- **Get started:** [Set up Roads API](https://developers.google.com/maps/documentation/roads/get-api-key.md.txt)
- **Pricing:** [Roads API usage and billing](https://developers.google.com/maps/documentation/roads/usage-and-billing.md.txt)
- **Policies:** [Roads API policies](https://developers.google.com/maps/documentation/roads/policies.md.txt)

## Roads API: related products

- **Often used with:** [Geocoding API](https://developers.google.com/maps/documentation/geocoding/quick-reference.md.txt)

## Roads API: common mistakes

- **Problem:** Calling `speedLimits` with a path of sparse or arbitrary points returns a `warningMessage` ("Input path is too sparse") and the speed limits may not match the intended segments. **Fix:** For arbitrary points, get place IDs from `nearestRoads` first and call `speedLimits` with those `placeId` values. See [/maps/documentation/roads/speed-limits](https://developers.google.com/maps/documentation/roads/speed-limits.md.txt).
- **Problem:** `speedLimits` returns no entry for a place ID that isn't a road segment (for example, a bridge's place ID), so the response can silently have fewer or no speed limits. **Fix:** Pass only road-segment place IDs, retrieved with `snapToRoads` or `nearestRoads`. See [/maps/documentation/roads/speed-limits](https://developers.google.com/maps/documentation/roads/speed-limits.md.txt).
- **Problem:** Snapped paths look jagged or off the road at high zoom when coordinates are stored at fewer than 7 decimal places or encoded as polylines (5-decimal precision), or when map tiles update after snapping. **Fix:** Store snapped latitude/longitude at 7 decimal places and don't use encoded polylines for high-zoom display. If neither precision issue applies, the map tiles may have changed since the path was snapped; re-snap old paths just before showing them. See [/maps/documentation/roads/errors](https://developers.google.com/maps/documentation/roads/errors.md.txt).
- **Problem:** Points sampled at long intervals (for example, every 60 seconds) or placed sparsely produce gaps or unsnapped points in the snapped path. **Fix:** Sample vehicle locations every 1-10 seconds. See [/maps/documentation/roads/errors](https://developers.google.com/maps/documentation/roads/errors.md.txt).
- **Problem:** Paths where consecutive points are too far apart can cause odd snapping behavior in `snapToRoads`, especially across GPS signal loss or noise. **Fix:** Keep consecutive points in `path` within 300 m of each other. See [/maps/documentation/roads/snap#path](https://developers.google.com/maps/documentation/roads/snap.md.txt#path).
- **Problem:** Calling `speedLimits` on a project without Asset Tracking access returns HTTP 403 `PERMISSION_DENIED` ("Speed limits are not available for this project."). **Fix:** Speed Limits requires an Asset Tracking license (or a transitioned Premium Plan `maps-asset-xxx` project); contact sales to enable Asset Tracking. See [/maps/documentation/roads/speed-limits](https://developers.google.com/maps/documentation/roads/speed-limits.md.txt).

## What you can do with Roads API

See the guides linked below for each task, or compare across products in the
[Capabilities Explorer](https://developers.google.com/maps/documentation/capabilities-explorer.md.txt).

- [Return a set of latitude/longitude coordinates that align with road segments and most closely match the path of a set of specified coordinates.](https://developers.google.com/maps/documentation/roads/snap.md.txt)
- [Return a set of latitude/longitude coordinates for the road segment closest to a set specified coordinates.](https://developers.google.com/maps/documentation/roads/nearest.md.txt)
- [Return the Google place identifier for the road segment closest to a set of latitude/longitude coordinates.](https://developers.google.com/maps/documentation/roads/nearest.md.txt#SnappedPoint-placeId)
- [Return the speed limit of the road segment that most closely matches the path of a set of latitude/longitude coordinates.](https://developers.google.com/maps/documentation/roads/speed-limits.md.txt#example_request_using_a_path) **Note:** Requires an Asset Tracking license.
- [Return the speed limit of the road segment for a provided Google place identifier.](https://developers.google.com/maps/documentation/roads/speed-limits.md.txt#example_request_using_place_ids) **Note:** Requires an Asset Tracking license.