Roadmap tiles are image tiles based on vector topographic data with Google’s cartographic styling. This includes roads, buildings, points of interest, and political boundaries.
Getting roadmap tiles
You can begin making roadmap tile requests after you get a session token. Because the session token applies to the entire session, you don't have to specify the map options with your tile requests.
The following code sample demonstrates a typical session token request for roadmap tiles.
curl -X POST -d '{ "mapType": "roadmap", "language": "en-US", "region": "US" }' \ -H 'Content-Type: application/json' \ "https://tile.googleapis.com/v1/createSession?key=YOUR_API_KEY"
You get roadmap tiles by making an HTTPS GET request, as shown in the following example.
curl "https://tile.googleapis.com/v1/2dtiles/z/x/y?session=YOUR_SESSION_TOKEN &key=YOUR_API_KEY &orientation=0_or_90_or_180_or_270"
In this HTTPS GET request, z
is the zoom level
(ranging from 0 to 22), and x
and
y
are the
tile coordinates
of the tile you want to retrieve.
The orientation
parameter is optional. Its value specifies the number of
degrees of counter-clockwise rotation of the tile image. orientation
is
supported for roadmap
tiles, and it's also supported for satellite and
terrain requests with base imagery removed using "overlay": true
, and with
layerTypes
set. Valid orientation
values are 0 (the default), 90, 180, and
270.
The tile coordinate grid isn't rotated if you include an orientation
value. For example, if you set orientation
to 90, then the
x
coordinate still defines the left-to-right
position of the tile, which in this case is from North to South on the map.
Zero-degrees orientation | 90-degrees orientation |
---|---|
Example tile request
Consider the following example, which requests a single tile that contains the entire world. In this example, zoom level is 0, and the x and y coordinates are 0, 0.
curl "https://tile.googleapis.com/v1/2dtiles/0/0/0?session=YOUR_SESSION_TOKEN&key=YOUR_API_KEY" --output /tmp/example_tile.png
There is no response message from the server in this example. Instead, the tile downloads to a local file, with the following statistics.
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 8335 100 8335 0 0 51471 0 --:--:-- --:--:-- --:--:-- 54835
For information about response message headers, see Pre-Fetching, Caching, or Storage of Content.