Template:Team:Aachen/MeetupMap1.js

From 2014.igem.org

Revision as of 20:52, 5 September 2014 by Mjoppich (Talk | contribs)
       var map, layer;
       function init(){
           OpenLayers.ProxyHost="/proxy/?url=";
           map = new OpenLayers.Map('map');
           layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
               "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
               
           map.addLayer(layer);
           map.setCenter(new OpenLayers.LonLat(0, 0), 0);
           var markers = new OpenLayers.Layer.Markers( "Markers" );
           map.addLayer(markers);
           var size = new OpenLayers.Size(21,25);
           var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
           var icon = new OpenLayers.Icon('http://2014.igem.org/images/wiki.png',size,offset);
           markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon));
           var halfIcon = icon.clone();
           markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,45),halfIcon));
           marker = new OpenLayers.Marker(new OpenLayers.LonLat(90,10),icon.clone());
           marker.setOpacity(0.2);
           marker.events.register('mousedown', marker, function(evt) { alert(this.icon.url); OpenLayers.Event.stop(evt); });
           markers.addMarker(marker); 
           map.addControl(new OpenLayers.Control.LayerSwitcher());
           map.zoomToMaxExtent();
           halfIcon.setOpacity(0.5);
       }