[OSGeo-Discuss] Call WFS layers
pascal evano
pascal2833 at gmail.com
Wed Nov 14 09:11:44 PST 2012
Hi,
First of all: sorry for my english!
I want to visualize a vector layer that i have imported in my geoserver
(new version, 2.2.1) from a .shp file.
My space name is "WMS_GetFeatureInfo" (space name by default) and services
WMS, WFS and WCS are enabled.
The problem is that i don't visualize the WFS layer above the WMS layer
(base layer) but i don't have an error message from firebug and the WFS
layer appears in the controlayer Switcher.
What is my error?
Thanks a lot,
Pascal.
This is my script:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>GetFeatureInfo</title>
<script type="text/javascript" src="OpenLayers.js"></script>
<script type="text/javascript">
var map_element;
//var info;
function init()
{
map_element = new OpenLayers.Map("map_element");
// Add controls to the map_element:
map_element.addControl(new OpenLayers.Control.LayerSwitcher());
// Add base layer:
var baselayer = new OpenLayers.Layer.WMS
(
"C'est la base Layer",
'http://vmap0.tiles.osgeo.org/wms/vmap0',
{layers: 'basic'},
{isBaseLayer: true, opacity: 0.8}
);
map_element.addLayer(baselayer); // important de separer add.layers/
wms and wfs ?
// ----- Create Vector layer (geoserver, localhost):
var limite_monde_wfs= new OpenLayers.Layer.Vector
(
"Limite_monde_WFS",
{
strategies: [new OpenLayers.Strategy.Fixed()],
projection: new OpenLayers.Projection("EPSG:4326"), //
necesary to precise?
protocol: new OpenLayers.Protocol.WFS
({
version: "1.1.0", //necesary to precise?
url: "
http://localhost:8080/geoserver/WMS_GetFeatureInfo/wfs", // adresse
correcte ?
featurePrefix: "WMS_GetFeatureInfo", // = nom
workspace
featureType: "ne_110m_admin_0_countries", // =
nom couche.
featureNS: "http://localhost/WMS_GetFeatureInfo",
// = name space uri.
})
}
);
//Add layers:
map_element.addLayer(limite_monde_wfs);
if(!map_element.getCenter())
{
map_element.zoomToMaxExtent();
}
}
</script>
</head>
<body onload="init()">
<div id="map_element"></div>
</body>
</html>
<http://localhost:8080/geoserver/web/?wicket:bookmarkablePage=:org.geoserver.web.data.workspace.WorkspaceEditPage&name=WMS_GetFeatureInfo>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/discuss/attachments/20121114/79625afb/attachment-0002.html>
More information about the Discuss
mailing list