我正在尝试在openlayers上添加一个带有2个点的geoserver图层。但我只得到没有积分的地图。这是我尝试的:
<html>
<head>
<title>OpenLayers Example</title>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
</head>
<body>
<div style="width:100%; height:100%" id="map"></div>
<script defer="defer" type="text/javascript">
var map = new OpenLayers.Map('map');
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
var cabin= new OpenLayers.Layer.WMS(
"Cabins",
"http://localhost:8080/geoserver/wms",
{layers: "cite::obj_geom",
transparent: false,
TILED: false,
styles: "point"
},
{isBaseLayer: false,
displayInLayerSwitcher: true,
format: "image/png",
visibility: false,
displayOutsideMaxExtent: false,
projection: new OpenLayers.Projection("EPSG:900913")
}
);
map.addLayers([wms,cabin]);
map.zoomToMaxExtent();
</script>
</body>
</html>
我做错了什么?我认为这是投影,但我改为EPSG:900913,与openlayers地图投影相同。
答案 0 :(得分:1)
重新安装geoserver后一切正常。代码是正确的!