Template:Team:Aachen/MeetupMap1.js

From 2014.igem.org

(Difference between revisions)
Line 1: Line 1:
-
        var map, layer;
+
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
 +
var mapOptions = {
 +
  zoom: 4,
 +
  center: myLatlng
 +
}
 +
var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
-
        function init(){
+
var marker = new google.maps.Marker({
-
            OpenLayers.ProxyHost="/proxy/?url=";
+
    position: myLatlng,
-
            map = new OpenLayers.Map('map');
+
    title:"Hello World!"
-
            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" );
+
// To add the marker to the map, call setMap();
-
            map.addLayer(markers);
+
marker.setMap(map);
-
 
+
-
            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);
+
-
        }
+

Revision as of 21:02, 5 September 2014

var myLatlng = new google.maps.LatLng(-25.363882,131.044922); var mapOptions = {

 zoom: 4,
 center: myLatlng

} var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);

var marker = new google.maps.Marker({

   position: myLatlng,
   title:"Hello World!"

});

// To add the marker to the map, call setMap(); marker.setMap(map);