Skip to content

Instantly share code, notes, and snippets.

@CloCkWeRX
Created February 13, 2012 05:34
Show Gist options
  • Save CloCkWeRX/1813953 to your computer and use it in GitHub Desktop.
Save CloCkWeRX/1813953 to your computer and use it in GitHub Desktop.
Nearmaps example
<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Valuation Exchange</title>
<script src="http://www.nearmap.com/api0.1/api.js" type="text/javascript"></script>
<script type="text/javascript">
function init() {
var map = new nearmap.maps.Map2(document.getElementById("map_element"), {
mapTypes: [
nearmap.maps.MapType.HYBRID_MAP,
nearmap.maps.MapType.PHOTO_MAP,
nearmap.maps.MapType.MULTI_VIEW_MAP,
nearmap.maps.MapType.MULTI_VIEW_NORTH_MAP,
nearmap.maps.MapType.MULTI_VIEW_EAST_MAP,
nearmap.maps.MapType.MULTI_VIEW_SOUTH_MAP,
nearmap.maps.MapType.MULTI_VIEW_WEST_MAP
]});
map.setCenter(new nearmap.maps.LatLng(-34.032605,151.070897), 19, nearmap.maps.MapType.HYBRID_MAP);
var point1 = new nearmap.maps.LatLng(-34.032605, 151.070897);
map.addOverlay(new nearmap.overlay.Marker(point1));
var top = new nearmap.maps.ControlPosition(nearmap.maps.ControlAnchor.ANCHOR_bottom_LEFT, new nearmap.maps.Size(5, 5));
var zoomControl = new nearmap.maps.SmallZoomControl();
map.addControl(zoomControl, top);
var topLeft = new nearmap.maps.ControlPosition(nearmap.maps.ControlAnchor.ANCHOR_bottom_LEFT, new nearmap.maps.Size(40, 5));
var mapTypes = new nearmap.maps.ToggleAndRotateMapTypeViewControl();
map.addControl(mapTypes, topLeft);
var timeline = new nearmap.maps.TimelineControl(false, false, map.getContainer(), {
controlLeft: mapTypes
});
map.addControl(timeline);
var timelineNode = timeline.getNode();
var timelineOffset = timeline.getHorizontalOffset();
timelineNode.style.left = (timelineOffset.left + 15) + 'px';
timelineNode.style.top = '5px';
map.enableScrollWheelZoom();
map.enableDoubleClickZoom();
}
</script>
</head>
<body onload="init()" onunload="nearmap.event.unload()">
<div id="map_element" style="width: 100%; height: 100%"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment