<html>
<head>
<title></title>
<style type="text/css" media="screen">
body {font-family:verdana, arial, helvetica, sans-serif;font-size:12px;padding:5px;margin:0;background-color:#FFF;}
p, ul, li {margin-top:0;margin-bottom:0;}
blockquote {margin-left:5px;}
div.signature {color:#666;font-size:0.9em;}
body {font-family:verdana, arial, helvetica, sans-serif;font-size:12px;padding:5px;margin:0;background-color:#FFF;}
p, ul, li {margin-top:0;margin-bottom:0;}
blockquote {margin-left:5px;}
div.signature {color:#666;font-size:0.9em;}
body {font-family:verdana, arial, helvetica, sans-serif;font-size:12px;padding:5px;margin:0;background-color:#FFF;}
p, ul, li {margin-top:0;margin-bottom:0;}
blockquote {margin-left:5px;}
div.signature {color:#666;font-size:0.9em;}
body {font-family:verdana, arial, helvetica, sans-serif;font-size:12px;padding:5px;margin:0;background-color:#FFF;}
p, ul, li {margin-top:0;margin-bottom:0;}
blockquote {margin-left:5px;}
div.signature {color:#666;font-size:0.9em;}</style>
</head>
<body style="margin: 0pt; padding: 0pt;">
Hi,<br />I have some data in geoserver and I want to display them. At the end I want to be able to click on an element and to get some informations about the clicked feature. So I added a wms-layer. Then I wanted to add a vector-layer with the same geometry but as vector elements. <br />My Problem now is that I can't see the vector elements. As you can see in the following code I added different elements (as WMS buildings and as vector roads) to see when the vector layer appears. I can see the title of the vector layer in the layerswitcher but not the layer itself.<br />So, what did I wrong? Can anybody help me?<br /><br />----------------------------------------------------------------------------------------------<br /><br />var map = new OpenLayers.Map("map-id", {<br />
<div style="margin-left: 40px;">projection: new OpenLayers.Projection("EPSG:900913"),<br /> </div>
<div style="margin-left: 40px;">units: "meters",<br /> </div>
<div style="margin-left: 40px;">maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),<br /> </div>
<div style="margin-left: 80px;">maxResolution: 156543.0339,<br /> </div>
<div style="margin-left: 80px;">numZoomLevels: 19,<br /> </div>
<div style="margin-left: 80px;">displayProjection: new OpenLayers.Projection("EPSG:4326"),<br /> </div>
<div style="margin-left: 80px;">controls:[<br /> </div>
<div style="margin-left: 120px;">new OpenLayers.Control.Scale(),<br /> </div>
<div style="margin-left: 120px;">new OpenLayers.Control.ScaleLine(),<br /> </div>
<div style="margin-left: 120px;">new OpenLayers.Control.ArgParser(),<br /> </div>
<div style="margin-left: 120px;">new OpenLayers.Control.Attribution(),<br /> </div>
<div style="margin-left: 120px;">new OpenLayers.Control.KeyboardDefaults(),<br /> </div>
<div style="margin-left: 120px;">new OpenLayers.Control.LayerSwitcher(),<br /> </div>
<div style="margin-left: 120px;">new OpenLayers.Control.MousePosition(),<br /> </div>
<div style="margin-left: 120px;">new OpenLayers.Control.Navigation(),<br /> </div>
<div style="margin-left: 120px;">new OpenLayers.Control.OverviewMap(),<br /> </div>
<div style="margin-left: 120px;">new OpenLayers.Control.PanZoomBar()<br /> </div>
<div style="margin-left: 120px;">]<br /> </div>
<div style="margin-left: 80px;">});<br /> </div>
<br /><br />
<div style="margin-left: 40px;">var base = new OpenLayers.Layer.WMS(<br /> </div>
<div style="margin-left: 80px;">"Sachsen Streets and Buildings",<br /> </div>
<div style="margin-left: 80px;">"<a href="http://localhost:8080/geoserver/wms",">http://localhost:8080/geoserver/wms",</a><br /> </div>
<div style="margin-left: 80px;">{layers: "Sachsen:buildings"},<br /> </div>
<div style="margin-left: 80px;">{styles:'BuildingsStyle',<br /> </div>
<div style="margin-left: 80px;">srs: 'EPSG:4326',<br /> </div>
<div style="margin-left: 80px;">format: 'image/png',<br /> </div>
<div style="margin-left: 80px;">transparent: 'true'<br /> </div>
<div style="margin-left: 80px;">}<br /> </div>
<div style="margin-left: 40px;">);<br /> </div>
<div style="margin-left: 40px;">map.addLayer(base);<br /> </div>
<br />
<div style="margin-left: 40px;">var buildings = new OpenLayers.Layer.Vector("Straßen", {<br /> </div>
<div style="margin-left: 80px;">strategies: [new OpenLayers.Strategy.BBOX()],<br /> </div>
<div style="margin-left: 80px;">protocol: new OpenLayers.Protocol.WFS({<br /> </div>
<div style="margin-left: 120px;">version: "1.0.0",<br /> </div>
<div style="margin-left: 120px;">url: "<a href="http://localhost:8080/geoserver/wfs",">http://localhost:8080/geoserver/wfs",</a><br /> </div>
<div style="margin-left: 120px;">featureType: "Sachsen:roads",<br /> </div>
<div style="margin-left: 120px;">featureNS: "<a href="http://download.geofabrik.de/osm/europe/germany/",">http://download.geofabrik.de/osm/europe/germany/",</a><br /> </div>
<div style="margin-left: 120px;">srsName: "EPSG:4326",<br /> </div>
<div style="margin-left: 120px;">geometryName: "the_geom"<br /> </div>
<div style="margin-left: 80px;">})<br /> </div>
<div style="margin-left: 40px;">});<br /> </div>
<div style="margin-left: 40px;">map.addLayer(buildings);<br /> </div>
<br />
<div style="margin-left: 40px;">map.setCenter(new OpenLayers.LonLat(13.723, 51.03).transform(<br /> </div>
<div style="margin-left: 40px;">new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913")), 15);<br /> </div>
<br />
<div style="margin-left: 40px;">var select = new OpenLayers.Control.SelectFeature([buildings]);<br /> </div>
<div style="margin-left: 40px;">map.addControl(select);<br /> </div>
<div style="margin-left: 40px;">select.activate();<br /> </div>
<br />...<br />-----------------------------------------------------------------------------------------
<div class="signature"><br /><br /><br />-- <br />Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir<br />belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de</div></body>
</html>