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.What maps are currently supported?
The EasyMap JavaScript API currently supports the following maps:- Google Maps (Version 2)
- Cloudmade Web Maps Lite (Version 0.2 and 0.3)
- Bing Maps (Version 6.1 and 6.2)
- Yahoo! Maps (Version 3.8)
- MapQuest (Version 5.3.x)
Quick Start
Add the followingscript tag to the header of the page where your map is.
<script src="http://api.webcams.travel/jsapi?devid=YOUR_DEVELOPER_ID" type="text/javascript"></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.
Google Maps Shortcut
On Google Maps the webcams are also available as a layer. With the following line of JavaScript code you can add the layer to your map ...
map.addOverlay(new GLayer('com.google.webcams'));
... where map is your current GMap2 instance. If you use this for displaying the webcams you don't have
to include EasyMap API code at all.
Show this example using GLayer and Google Maps.
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. |
<script src="http://api.webcams.travel/jsapi?devid=YOUR_DEVELOPER_ID" type="text/javascript"></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:
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.
|
| 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. |
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



