Static Maps API
Introduction
The Maptoolkit Static Maps API gives back images (JPEG or PNG) with Maptoolkit Relief Maps, and optionally geo-content rendered into the images. See below for examples. The API is really simple to use. Images are rendered at first call and cached on file level thereafter.
Authentication
Every request have to be signed by an API key. For a detailed explanation click here.
Parameter Usage
The Static Maps API is relatively easy to use, as it consists solely of a parameterized URL. This section explains how to use these parameters to construct your URLs.
Specifiying Locations with Center and Zoom:
https://maptoolkit.p.rapidapi.com/staticmap/?maptype=terrain&size=750x300¢er=48.205,16.398&zoom=10&rapidapi-key=your-api-key
Specifiying Locations with Bounds:
https://maptoolkit.p.rapidapi.com/staticmap/?maptype=terrain&size=750x300&bounds=51,11,50,10&rapidapi-key=your-api-key
URL Parameters
A Maptoolkit Static Maps API URL must be of the following form:
https://maptoolkit.p.rapidapi.com/staticmap?parameters
Authentication:
Name | Description |
---|---|
api_key | Your API key. |
Location Parameters:
Name | Description |
---|---|
center | defines the center of the map. This parameter takes a location as a comma-separated {latitude,longitude} pair (e.g. "40.714728,-73.998672") |
zoom | defines the zoom level of the map, which determines the magnification level of the map (Number between 1 and 17, 1 being the entire world and 17 being neighborhood level). |
bounds | (instead of center & zoom): This parameter takes the bounds as a comma-separated {north,east,south,west} list (e.g. "51,11,50,10") |
delta_zoom | This parameter adds a delta to a calculated (e.g. a bounds request) zoom value |
Map Parameters:
Name | Description |
---|---|
size | defines the rectangular dimensions of the map image. This parameter takes a string of the form {widthxheight} (e.g. 400x300) |
format | defines the format of the resulting image. By default, the Maptoolkit Maps API creates PNG images. Allowed values are jpeg, png and webp. |
maptype | defines the maptype. Available values are terrain (= default), terrainwinter and light. |
factor | defines the factor of the resulting image. By default is 1, for retina tiles use 2. |
Feature Parameters:
Name | Description |
---|---|
marker | define one or more markers to attach to the image at specified locations. This parameter takes a single marker definition with parameters separated by the pipe character (|). you may add additional markers by adding additional marker parameters. |
path | defines a single path of two or more connected points to overlay on the image at specified locations. This parameter takes a string of point definitions separated by the pipe character (|). You may supply additional paths by adding additional path parameters. |
kml | defines a kml-file URL. Polylines and Polygons of this KML file will be rendered on the map. |
Markers
The marker parameter takes set of value assignments (marker descriptors):
Name | Description |
---|---|
icon | specifies the URL to use as the marker's icon. Images should be in PNG format. |
anchor | specify the icon anchor to 'center' or 'bottom'. Default 'bottom' |
center | defines the position of the marker. This parameter takes a location as a comma-separated {latitude,longitude} pair (e.g. "40.714728,-73.998672") |
in the following format:
marker=icon:{icon_url}|anchor:{center|bottom}|center:{lat,lng}
Example1: display a marker with the default icon
https://maptoolkit.p.rapidapi.com/staticmap/?maptype=terrain&size=750x300¢er=47.3,12.3&zoom=12&marker=center:47.3,12.3|anchor:bottom&rapidapi-key=your-api-key
Example2: display a markers with custom icon
https://maptoolkit.p.rapidapi.com/staticmap/?maptype=terrain&size=750x300¢er=47.3,12.3&zoom=12&marker=icon:http://static.maptoolkit.net/images/mtkdemo/marker/wandermap.png|center:47.3,12.3|anchor:bottom&rapidapi-key=your-api-key
Example3: display 2 markers
https://maptoolkit.p.rapidapi.com/staticmap/?maptype=terrain&size=750x300¢er=47.3,12.3&zoom=12&marker=center:47.3,12.3|anchor:bottom&marker=center:47.31,12.31&rapidapi-key=your-api-key
Marker z-index logic
Markers are either rendered in the order that they appear in the URL or by their y-position relative to the viewport. To control the order and prioritization of symbols use the HTTP parameter: symbol-z-order
with the value viewport
to calculate visibility by the y-position, else use source
. Default is viewport
.
Polylines
The path parameter defines a set of one or more locations connected by a path to overlay on the map image. The path parameter takes set of value assignments (path descriptors)
Name | Description |
---|---|
weight | specifies the thickness of the path in pixels. If no weight parameter is set, the path will appear in its default thickness (3 pixels). |
color | specifies a color either as a 32-bit hexadecimal value (example: color=0xFFFFCCFF) |
points | defines the vertices of the polyline. This parameter takes locations as a list of comma-separated {latitude,longitude} pair delimitied by a pipe character (|). |
in the following format:
path=weight:{weight}|color:{32bit_color}|points:{lat,lng}|{lat2,lng2}|...
Example:
https://maptoolkit.p.rapidapi.com/staticmap/?maptype=terrain&size=750x300&bounds=47.28852,12.52935,47.21155,12.16843&path=width:3|points:47.21359,12.16856|47.21155,12.16860|47.22167,12.18551|47.22563,12.18671|47.23277,12.19839|47.23571,12.19585|47.24233,12.21152|47.24244,12.21654|47.24664,12.21920|47.24693,12.22783|47.24399,12.22757|47.24419,12.24448|47.23644,12.24632|47.23242,12.24504|47.23134,12.24714|47.23828,12.25392|47.24402,12.26336|47.24533,12.27194|47.25212,12.27336|47.25369,12.27696|47.25372,12.28628|47.25101,12.28508|47.24947,12.28688|47.24923,12.29417|47.25200,12.29641|47.25016,12.30331|47.25296,12.31632|47.25978,12.31834|47.26720,12.33580|47.27093,12.33911|47.27268,12.34790|47.27591,12.35331|47.27524,12.36142|47.27978,12.37425|47.27306,12.37558|47.27871,12.39824|47.27757,12.41674|47.27358,12.42245|47.27792,12.42352|47.27882,12.44373|47.28336,12.45489|47.28307,12.48025|47.28103,12.48150|47.28060,12.48562|47.27786,12.48729|47.27780,12.49296|47.28118,12.50270|47.28051,12.52274|47.28255,12.52695|47.28852,12.52935&rapidapi-key=your-api-key
GeoJSON Line-/MultiLineString
The geojson parameter defines a set of one or more locations connected by a path to overlay on the map image. It takes set of value assignments (path descriptors)
Name | Description |
---|---|
weight | specifies the thickness of the path in pixels. If no weight parameter is set, the path will appear in its default thickness (3 pixels). |
color | specifies a color in 32-bit hexadecimal RGBA value (example: color=FFFFCCFF) |
geometry | defines the geometry in GeoJSON format. This parameter takes an Object with type and coordinates properties. Currently supported feature types are LineString and MultiLineString . |
in the following format:
geojson=color:ff000066|width:6|geometry:{"type": "LineString", "coordinates": [[lng, lat], ...]]}
Example:
https://maptoolkit.p.rapidapi.com/staticmap/?maptype=terrain&size=500x500&geojson=color:ff000066|width:6|geometry:{"type":"MultiLineString","coordinates":[[[16.431427001953125,47.845883513447276],[16.481552124023438,47.821915003877976],[16.495285034179688,47.817304405844226],[16.556396484375,47.832056878293166]],[[16.53511047363281,47.8703015638657],[16.53717041015625,47.85740289465826],[16.5234375,47.83482250011287],[16.513824462890625,47.816382237102744],[16.489105224609375,47.794245273679884],[16.478118896484375,47.77855921633884]]]}&rapidapi-key=your-api-key
KML
The kml parameter defines a URL to a KML-file. The kml parameter can only defined once! Polylines or Polygons will be extracted from the KML file and rendered on the staticmap.
Polygon Example:
https://maptoolkit.p.rapidapi.com/staticmap/?maptype=terrain&size=750x400¢er=47.805,13.35&zoom=7&kml=http://static.maptoolkit.net/austria.kml&rapidapi-key=your-api-key
Polyline Example with a Startmarker:
https://maptoolkit.p.rapidapi.com/staticmap/?maptype=terrain&size=750x300&bounds=47.28852,12.52935,47.21155,12.16843&kml=http://maptoolkit.net/export/outdoorish_bikemap_routes/123.kml?color=ff34a853&marker=icon:http://static.maptoolkit.net/images/mtkdemo/marker/wandermap.png|center:47.21359,12.16856|anchor:bottom&rapidapi-key=your-api-key