Webcams.travel - The Webcam Community - Home
Live   Popular   Featured   New   Map


Back to the API index page

EasyMap JavaScript API


Important: The EasyMap JavaScript API is in beta stage and currently offers only a limited set of functionality. More functionality will be added.


To use the EasyMap JavaScript API you need a developer ID. Please signup for a developer ID if you do not already have one.

What is the EasyMap JavaScript API?

The EasyMap JavaScript API lets you easily add the webcams of webcams.travel to your existing map on your site with only a few lines of JavaScript code.
EasyMap Demo
EasyMap Demo


What maps are currently supported?

The EasyMap JavaScript API currently supports the following maps:

If you use one of these map APIs on your site you can add the webcams of webcams.travel to your map in no time.

Terms and Conditions of Use

  1. You must provide a link to webcams.travel with the text "EasyMap webcams provided by webcams.travel" in the context of the EasyMap. HTML code:
  2. You must send us a screenshot or link of your implementation of the EasyMap JavaScript API to api@webcams.travel before you publish.


Quick Start

Add the following script tag to the header of the page where your map is.
<script src="http://api.webcams.travel/jsapi?devid=YOUR_DEVELOPER_ID"></script>
Please keep in mind that you add this script tag after the script tag you use for loading the map API.

To eventually display the webcams on your map, simply add this line of JavaScript code to your page.
webcamstravel.easymap.load(map);
The parameter map that is used for the webcamstravel.easymap.load() function has to be a valid instance of one of the supported map APIs you want the webcams add to.

To see an example, please signup for a developer ID.

API Description

This section describes the EasyMap JavaScript API in detail.

In order to get access to the API you need to load the API code into your page from http://api.webcams.travel/jsapi. You have to pass your developer ID:
Parameter Description
devid Your developer ID. Please signup for a developer ID if you do not already have one.
Example:
<script src="http://api.webcams.travel/jsapi?devid=YOUR_DEVELOPER_ID"></script>
After loading the API into your page you have these functions available:
Function Return value Description
webcamstravel.easymap.load(map,
callback?, options?)
Handle Adds the webcams to map which is an instance of a supported map. The callback has to be a function and gets called as soon as the webcams has been loaded. The signature of the callback is function(Object instance, mixed params). The callback gets called with the instance of the webcam loader as parameter. The third parameter options is an object literal with the following properties:
Property Type Default Description
showwebcams Boolean true Tells the API if the webcams should be shown after they have been loaded. Defaults to true. If you set it to false you have to make the webcams visible with the showWebcams() method of the webcam loader instance.
params mixed null User-defined data that will be passed to the callback along with the instance.
The returned handle can be used to retrieve the instance of the webcam loader.
webcamstravel.easymap.unload() none Unloads the webcams from your map(s).
webcamstravel.easymap.getInstance(handle) Object Retrieve the instance of the webcam loader that is assigned to the given handle. The handle is the return value of the load() function. You get the same webcam loader instance if you use the callback mechanism of the load() function. The return value is null if the handle is invalid or the webcam loader instance isn't ready yet.
With the webcam loader instance you can control the display of the webcams on your map. These methods are currently available:
Function Return value Description
showWebcams() none Displays the webcams on your map. The webcams that get displayed depend on the current viewport of your map and the current zoom level.
hideWebcams() none Removes the webcams from your map.
unload() none Removes the webcams from your map and unloads the webcam loader. This renders the instance of the webcam loader invalid.
Please consider that the EasyMap JavaScript API is currently in beta stage and offers only a limited set of functionality. More functionality will be added.

If you have questions or suggestions, feel free to get in touch with us. Please visit our webcams.travel API discussion group


Back to the API index page
Webcam search