Skip to content

Instantly share code, notes, and snippets.

@kylethompson
Last active December 12, 2015 01:58
Show Gist options
  • Save kylethompson/4695127 to your computer and use it in GitHub Desktop.
Save kylethompson/4695127 to your computer and use it in GitHub Desktop.
Simple map viewer using opengeo with world borders and city temperature layers
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="http://localhost:8080/geoserver/openlayers/theme/default/style.css"/>
<script src="http://localhost:8080/geoserver/openlayers/OpenLayers.js" type="text/javascript">
</script>
<script defer="defer" type="text/javascript">
var map;
function init(){
var bounds = new OpenLayers.Bounds(
-180, -90,
180, 83.624
);
var options = {
controls: [],
maxExtent: bounds,
maxResolution: 1.40625,
projection: "EPSG:4326",
units: 'degrees'
};
map = new OpenLayers.Map('map', options);
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://localhost:8080/geoserver/world/wms", {layers: 'world:borders'}, {isBaseLayer : true} );
var citiesTemperatureLayer = new OpenLayers.Layer.WMS("world:cities - Tiled",
"http://localhost:8080/geoserver/world/wms", {layers: 'world:globedata_temp', transparent: 'true'},
{ isBaseLayer: false } );
map.addLayers([wms, citiesTemperatureLayer]);
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.Navigation());
map.zoomToExtent(bounds);
}
</script>
</head>
<body onload="init()">
<div id="map" style="height : 500px; width : 1200px">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment