Raster Tiles API
The Raster Tiles API service provides raster tiles for 2D maps.
To work with raster tiles, depending on your needs, you can use:
- the public endpoint for integration with third-party libraries or custom implementations.
- RasterJS API library to display the map with minimal configuration.
Getting started
Getting access key
- Sign in to the Platform Manager.
- Create a demo key or purchase a subscription for using API. For details on service prices, see the Tariffs section.
Note
If you already have an active API key obtained for RasterJS API, you can use it with Raster Tiles API until the subscription expires. You can view the subscription expiration date in the Platform Manager, on the Dashboard tab.
To work with access keys, you can use the Platform Manager: for details, see the account documentation.
Using public endpoint
When using third-party libraries, specify the endpoint for loading tile images:
https://tile{n}.maps.2gis.com/v2/tiles/{tileset}/{z}/{x}/{y}.png?key={key}
Here:
n- host number that can range from 0 to 4. You can use a single host for low traffic volumes or distribute requests across multiple hosts manually.tileset- tile set. For example,online_hdfor high-resolution tiles oronline_sdfor standard-resolution tiles.z- map zoom level. The higher the number, the more detailed the map.x,y- tile coordinates.key- your API key.
Request example:
https://tile0.maps.2gis.com/v2/tiles/online_hd/16/47851/20734.png?key=YOUR_KEY
Integrating RasterJS API library
RasterJS API is a free JavaScript library for working with 2D 2GIS maps. The library contains a ready-made set of tools for interacting with the map, automatically requests raster tiles, and displays them on the page.
To use the tiles provided by the Raster Tiles API service with the RasterJS API library, first obtain an API key, then install the library in your project. For more details, see the Getting started instruction.
Usage example
Tariffs
- Service tariff includes a fixed number of billable events per period. Unlimited access to the RasterJS API library is provided free of charge.
- For Raster Tiles API, a billable event is a successful request that returns a raster tile in PNG format.
- Current prices for services are available in the Platform Manager.
Deployment options
- Cloud-based: Raster Tiles API is available through public 2GIS endpoints.
- On-Premise: to get raster tiles, install Tiles API as part of the 2GIS API Platform in a private network. For more information, see the API Platform for server.