How to integrate our code
Our basic code & options
Script
<script src="https://webkarten.theswissdigital.ch/js/tsd-webkarten-client.js" type="text/javascript"></script>
HTML
<div id="mapcontainer"></div>
Javascript
var map = null;
TsdWebkartenEvents.addDomListener(window, 'load', function () {
map = new TsdWebkarten({
city : 'YOUR_MAP_CODE',
api_key : 'YOUR_MAP_API_KEY',
container_id: 'mapcontainer',
width : 800,
height : 500,
language : 'de'
});
// ... Custom events (optional)
map.listen(); // Start listener for custom actions
});
// Action functions (optional)
Options
Configuration options
Option | Required | Type | Details |
---|---|---|---|
city | Mandatory | String | Map CODE received from Historika |
api_key | Mandatory | String | Map API_KEY received from Historika |
container_id | Optional | String | Default value: mapcontainer Container ID in witch map will be generated. |
width | Optional | Number | Default value: 600 Map width |
height | Optional | Number | Default value: 400 Map height |
language | Optional | String | Default value: de Map language. Possible map languages are defined by Historika |
Events
Custom Events for map manipulation. Events are send from Historika Map to Customers web page
Event | Description |
---|---|
appReady | Triggers when Application is ready
|
appLoaded | Triggers when application is Loaded. Map is not yet ready for usage in this point.
|
mapReady |
Map is ready for usage. In this point you can add your custom markers.
|
categoryChanged | Triggers when user change visibility of category
|
fullscreenToggled | Triggers when user toggles fullscreen mode on map
|
searchTermChanged | Triggers when user makes search on map sidebar (visible wneh in fullscreen mode)
|
onError | Triggers when map can not be loaded.
|
Actions
Custom Actions for map manipulation. Actions are send from Customers web page to Historika Map
Action | Description |
---|---|
toggleCategory | Shows / Hides category on map List of map categories was received in event appLoaded
|
changeLanguage | Changes Map language. Map is in this point reloaded. List of possible map languages was received in event: appReady
|
toggleFullscreen |
Show map in fullscreen.
|
addMarker | Add your custom marker on map
|
search | Searches on map
|
activatePoi | Opens POI details on map
|