[OpenLayers-Users] What's wrong with this program?
djs7743 at att.net
djs7743 at att.net
Tue Mar 11 19:28:04 EDT 2008
Can anyone tell me what's wrong with the following simple OL program? All I get is a solid pink box. Starting with the "lite" example on OL.org, all I've done is replace the WMS with a different one.
I'm pretty sure all my OpenLayers.Layers.WMS params are correct, at least conceptually, because typing the following url into my browser brings up a nice image.
http://svs.gsfc.nasa.gov/cgi-bin/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=3338_24550&FORMAT=image/png&WIDTH=644&HEIGHT=289&CRS=CRS:84&BBOX=-180,-90,180,90&STYLES=
I'm guessing I might be botching the syntax to OpenLayers.Layers.WMS. Or maybe I need to do something with the size of the image that I don't realize I need to do?
Any help would be much appreciated. As you can probably tell, I'm a complete newbie at this.
Thanks,
Darrin
-------Program Follows------------
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OpenLayers Basic Single WMS Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
<style type="text/css">
#map {
width: 512px;
height: 512px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
var map, layer;
function init(){
map = new OpenLayers.Map( 'map' );
// different layer added here by DJS, used to be
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://svs.gsfc.nasa.gov/cgi-bin/wms?",
{layers: '3338_24550',
VERSION: "1.3.0",
format: "image/png",
width: 644, height: 289,
styles: "opaque",
crs: "CRS:84", bbox: "-180,-90,180,90"});
map.addLayer(layer);
map.zoomToMaxExtent();
}
</script>
</head>
<body onload="init()">
<h1 id="title">Basic Single WMS Example</h1>
<div id="tags"></div>
<div id="shortdesc">Show a Simple Map</div>
<div id="map"></div>
<div id="docs">
This example shows a very simple layout with minimal controls. This example uses a single WMS base layer.
</div>
</body>
</html>
More information about the Users
mailing list