Code (This is how the code looks like based on the configuration above. It can be copied and pasted directly into your project):
<html>
<head>
<title>SiteWatch API Example Viewer</title>
<script src='http://kort.samsyn.is/api/SiteWatch.aspx?v=2&key=your_keycode' type='text/javascript'></script>
<script type='text/javascript'>
//A map object variable.
var map;
//Create a map object.
function InitMap() {
map = SWMap.create('map',
{ panButton: false, zoomButton: false,
defaultZoom: 10, defaultCenterPoint: { x: 359583, y: 406481 }
});
//Create an isn93 projected point object from wgs84 coordinates.
var isn93 = SiteWatch_API.WGS84_To_ISN93(64.132384, -21.884217);
//A string variable with a value.
var title_location = '<b>X:</b> ' + isn93.x + '<br><b>Y:</b> ' + isn93.y;
//Create a wgs84 projected point object from isn93 coordinates.
var wgs84 = SiteWatch_API.ISN93_To_WGS84(isn93.x, isn93.y);
//A string variable with a value.
var title_location_add = title_location + '<br><b>Lat:</b> ' + wgs84.lat + '<br><b>Lon:</b> ' + wgs84.lon;
//Create a marker object.
var marker = map.addMarker('latlon',
{ x: 359583, y: 406481 },
{ text: title_location_add }, { url: 'http://kort.samsyn.is/api/img/house.png' });
};
</script>
</head>
<body onload='InitMap()'>
<div id='map' style='height:300px; width:600px;'></div>
</body>
</html>
|