Show channel location on a map
Use Show Channel Map
to embed a map on a web
page.
GET
https://thingspeak.com/channels/
<channel_id>
/maps/channel_show
Name | Description |
---|---|
| (Required) Channel ID for the channel of interest. |
Example URL:
https://thingspeak.com/channels/276330/maps/channel_show
Name | Description | Value Type |
---|---|---|
read_api_key | (Required for private channels). Specify read API key for this specific channel. Find the read API key on the API Keys tab of the channel view. | string |
width | (Optional) Map width in pixels. Default map width is 450. | integer |
height | (Optional) Chart height in pixels. Default map height is 260. | integer |
200 OK
GET https://thingspeak.com/channels/12397/maps/channel_show |
The response is a map showing a marker for the latitude and longitude set on the Channel Settings page. |
For the full list, see Error Codes.
If you do not have access to the channel, the response is The requested
map is not accessible. Provide a public channel or the read API key for the
private channel as a parameter: read_api_key=XXXXXXXXXXXXXXXX
.
Create the Show Channel Map
REST call using the example
format. Add the read_api_key
parameter if the channel is
private. Use a web browser to test the call.
Create a html file with the following elements. Replace
<channel_id>
with your channel ID and
XXXXXXXXXXXXXXXX
with the read API key for the
channel of interest.
<html><head><title>ThingSpeak Embedded Map</title></head> <body> <iframe width="650" height="800" style="border: 1px solid #cccccc;" src="https://thingspeak.com/channels/<channel_id>/maps/channel_show?read_api_key=XXXXXXXXXXXXXXXX&height=800"> </body></html>
Save the file with the .HTML
extension.
Open the file with a web browser to view the embedded map.