[Users] vector layer from WFS not visible
Kathrin Babiker
k.babiker at gmx.de
Mon Oct 10 14:24:49 CEST 2011
Hi,
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.
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.
So, what did I wrong? Can anybody help me?
----------------------------------------------------------------------------------------------
var map = new OpenLayers.Map("map-id", {
projection: new OpenLayers.Projection("EPSG:900913"),
units: "meters",
maxExtent: new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
maxResolution: 156543.0339,
numZoomLevels: 19,
displayProjection: new OpenLayers.Projection("EPSG:4326"),
controls:[
new OpenLayers.Control.Scale(),
new OpenLayers.Control.ScaleLine(),
new OpenLayers.Control.ArgParser(),
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.KeyboardDefaults(),
new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.OverviewMap(),
new OpenLayers.Control.PanZoomBar()
]
});
var base = new OpenLayers.Layer.WMS(
"Sachsen Streets and Buildings",
"http://localhost:8080/geoserver/wms",
{layers: "Sachsen:buildings"},
{styles:'BuildingsStyle',
srs: 'EPSG:4326',
format: 'image/png',
transparent: 'true'
}
);
map.addLayer(base);
var buildings = new OpenLayers.Layer.Vector("Straßen", {
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({
version: "1.0.0",
url: "http://localhost:8080/geoserver/wfs",
featureType: "Sachsen:roads",
featureNS: "http://download.geofabrik.de/osm/europe/germany/",
srsName: "EPSG:4326",
geometryName: "the_geom"
})
});
map.addLayer(buildings);
map.setCenter(new OpenLayers.LonLat(13.723, 51.03).transform(
new OpenLayers.Projection("EPSG:4326"), new
OpenLayers.Projection("EPSG:900913")), 15);
var select = new OpenLayers.Control.SelectFeature([buildings]);
map.addControl(select);
select.activate();
...
-----------------------------------------------------------------------------------------
--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20111010/b861915a/attachment.htm
More information about the Users
mailing list