Template:Team:Aachen/MeetupMap1.js
From 2014.igem.org
(Difference between revisions)
Line 2: | Line 2: | ||
function init(){ | function init(){ | ||
- | + | map = new OpenLayers.Map("map"); | |
- | + | map.addLayer(new OpenLayers.Layer.OSM()); | |
- | + | ||
- | + | var lonLat = new OpenLayers.LonLat( -0.1279688 ,51.5077286 ) | |
- | + | .transform( | |
- | + | new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984 | |
- | + | map.getProjectionObject() // to Spherical Mercator Projection | |
- | + | ); | |
- | + | ||
- | + | var zoom=16; | |
- | + | ||
- | + | var markers = new OpenLayers.Layer.Markers( "Markers" ); | |
- | map. | + | map.addLayer(markers); |
- | + | ||
- | + | markers.addMarker(new OpenLayers.Marker(lonLat)); | |
- | + | ||
- | + | map.setCenter (lonLat, zoom); | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
} | } |
Revision as of 20:48, 5 September 2014
var map, layer;
function init(){ map = new OpenLayers.Map("map"); map.addLayer(new OpenLayers.Layer.OSM()); var lonLat = new OpenLayers.LonLat( -0.1279688 ,51.5077286 ) .transform( new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984 map.getProjectionObject() // to Spherical Mercator Projection ); var zoom=16; var markers = new OpenLayers.Layer.Markers( "Markers" ); map.addLayer(markers); markers.addMarker(new OpenLayers.Marker(lonLat)); map.setCenter (lonLat, zoom); }