git-svn-id: http://svn.openlayers.org/trunk/openlayers@1096 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
68 lines
2.2 KiB
HTML
68 lines
2.2 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
|
|
<style type="text/css">
|
|
#map {
|
|
width: 800px;
|
|
height: 475px;
|
|
border: 1px solid black;
|
|
}
|
|
</style>
|
|
<!-- gmaps api key for http://openlayers.org/~euzuro -->
|
|
<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA9XNhd8q0UdwNC7YSO4YZghQELW4Ku31wWCtlZquTlkHLCFh9LBTYvc_eIShlmo0YZwSitw0fQ1ZyXA'></script>
|
|
<script src="../lib/OpenLayers.js"></script>
|
|
<script type="text/javascript">
|
|
<!--
|
|
var lon = 5;
|
|
var lat = 40;
|
|
var zoom = 5;
|
|
var map, layer, glayer;
|
|
|
|
function init(){
|
|
map = new OpenLayers.Map( $('map') );
|
|
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
|
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
|
map.addLayer(layer);
|
|
|
|
glayer = new OpenLayers.Layer.Google("goog");
|
|
map.addLayer(glayer);
|
|
|
|
layer = new OpenLayers.Layer.WFS( "wfs",
|
|
"http://labs.metacarta.com/search/WFS?",
|
|
{maxfeatures: 1},
|
|
{ featureClass: OpenLayers.Feature.WFS});
|
|
map.addLayer(layer);
|
|
|
|
|
|
map.setCenter(new OpenLayers.LonLat(0, 0), 2);
|
|
|
|
map.addControl( new OpenLayers.Control.LayerSwitcher() );
|
|
}
|
|
|
|
function add() {
|
|
|
|
markers2 = new OpenLayers.Layer.Markers("markers2");
|
|
map.addLayer(markers2);
|
|
|
|
|
|
var icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',new OpenLayers.Size(10,17));
|
|
marker = new OpenLayers.Marker(new OpenLayers.LonLat(2, 41), icon);
|
|
markers.addMarker(marker);
|
|
}
|
|
|
|
|
|
function remove() {
|
|
markers.removeMarker(marker);
|
|
}
|
|
|
|
|
|
// -->
|
|
</script>
|
|
</head>
|
|
<body onload="init()">
|
|
<div id="map"></div>
|
|
<div style="background-color:green" onclick="add()"> click to add the marker to the map</div>
|
|
<div style="background-color:red" onclick="remove()"> click to remove the marker from the map</div>
|
|
</body>
|
|
</html>
|