Working With OpenLayerscss
This module walks through the basics of creating web maps with OpenLayers. The reader will learn how to create an OpenLayers map from scratch, overlay data from various sources, and work with vector feature editing and styling.html
<html>web
<head>api
<title>Basic Map</title>app
<style type="text/css">ide
#map_container {ui
width: 512px;this
height: 256px;url
border: 1px solid gray;code
}
</style>
<script src="openlayers/OpenLayers.js">
</script>
</head>
<body>
<h2>Basic Map</h2>
<div id="map_container"></div>
<script>
// your application code here
</script>
</body>
</html>
1. Visit the following url in the web browser:
http://localhost:8910/geoserver/www/ol-basics.html
2. Open ol-basics.html.
var map = new OpenLayers.Map("map_container");
var wms = new OpenLayers.Layer.WMS(
"OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: "basic"}
);
map.addLayer(wms);
map.zoomToMaxExtent();
4. Save changes to ol-basics.html.
5. Return to the web browser and refresh the page. (F5)