Map Tile
Contents
Map tiles are small rectangular images that are displayed in a grid arrangement to show a larger map image.
The Map Tile API retrieves a single raster map tile image at a given location and zoom level. Tiles can be rendered in either a .jpeg or a .png format and displayed in a wide range of satellite and road map styles.
The service can be used to draw maps that can pan or zoom to show varying levels of detail at locations around the world—from the entire world in a single tile at zoom level 0 to tiles that display individually labeled roads and buildings at higher zoom levels.
Requires a license for access to Trimble Maps JavaScript.
GET /maptile
Resource URL
https://pcmiler.alk.com/apis/rest/v1.0/service.svc/maptile
Request Parameters
To display tiles for a specific location, you need to know the z/y/x coordinates of that location, which are the only required parameters for a request. Any additional parameters not specified will use default values.
Parameter | Description | Data Type | Note | |
---|---|---|---|---|
X | The tile's horizontal coordinate. |
integer | ||
Y | The tile's vertical coordinate. |
integer | ||
Z | The zoom level. |
integer | ||
Format | Optional parameter to specify the image format. |
string | Formats are: image/png image/jpeg (default) | |
Dataset |
For users licensed for multiple regional datasets this allows you to target data from different regions or
access the WorldWide data. Read more about setting the dataset .
| Current (default), PCM_EU, PCM_OC, PCM_SA, PCM_AF, PCM_AS, PCM_ME, PCM_GT, PCM_WW and PCM_NA. | ||
Style | The style of map image | Default (default), Classic, Monochrome, RoadAtlas, Darkness, Modern, Contemporary, Night, Satellite, Lightness, Smooth and Terrain | See special notes below about Satellite style with ImgSrc. | |
ImgSrc |
Optional background image provider. Currently only supports Satellite style and will be ignored for
all others.
|
ALKCurated Default(DigitalGlobeAPIImagery) Sat1 Sat2(DigitalGlobeConsumer) Sat3(DigitalGlobeTrueCurrency) Sat4(DigitalGlobeColorConsumer) Sat5(DigitalGlobeAPIVivid) Sat6(DigitalGlobeAPIRecent) |
Sat1 is a Premium Satellite option that provides curated Satellite images and tiles to users. If no curated data
is available, Default(DigitalGlobeAPIImagery) option will be used. ALKCurated is a Satellite option available to all users. However, certain curated data is excluded and Default(DigitalGlobeAPIImagery) option will be used instead. Values other than Default or ALKCurated require a Premium add-on license for that style. |
Sample Request - Default Style
The sample URL below retrieves a map tile at zoom level 6
near the border of Oklahoma and Texas in the United States. It uses the default
road map style.
http://pcmiler.alk.com/apis/rest/v1.0/Service.svc/maptile?X=14&Y=25&Z=6&dataset=PCM_NA&authtoken={Insert Your API key}
Sample Request - Satellite Style
The same request using a satellite
map style.
http://pcmiler.alk.com/apis/rest/v1.0/Service.svc/maptile?X=14&Y=25&Z=6&dataset=PCM_NA&style=satellite&authtoken={Insert Your API key}
Convert Coordinates
The sample code below can be used to convert longitude/latitude coordinates to the x
and y
coordinates used in the API.
var zoom = 20;
var lat = -43.544811293444496;
var lon = 172.59168983612773;
function long2tile(lon, zoom) {
return Math.floor((lon + 180) / 360 * Math.pow(2, zoom));
}
function lat2tile(lat, zoom) {
return Math.floor(
(1 -
Math.log(Math.tan((lat * Math.PI) / 180) + 1 / Math.cos((lat * Math.PI) / 180)) /
Math.PI) /
2 *
Math.pow(2, zoom)
);
}
var x = long2tile(lon, zoom); // get x long2tile
var y = lat2tile(lat, zoom); // get y lat2tile
tileUrl =
"https://pcmiler.alk.com/apis/rest/v1.0/service.svc/maptile?authtoken={API Key}&X=" +
x +
"&Y=" +
y +
"&Z=" +
zoom +
"&ImgSrc=Sat2&style=Satellite&dataset=PCM_OC";