[OpenLayers-Users] WFS GetFeature with Mapserver,
multiple layers (typenames)
Attila BERÉNYI
atis at airdesignstudio.hu
Wed Apr 7 16:26:19 EDT 2010
Hi,
Your code looks fine for me at first sight, what are the errors that you
mention?
Could you send a link or something where we can see what you have been
done so far?
Cheers,
Attila
2010.04.07. 17:31 keltezéssel, sunny74 írta:
> Hi Attila,
>
> I had a look at your previous post i.e
> http://n2.nabble.com/WFS-GetFeature-with-Mapserver-td4748857.html#a4748857
> http://n2.nabble.com/WFS-GetFeature-with-Mapserver-td4748857.html#a4748857
>
> and also the link where you have the working example of WFS GetFeature with
> Mapserver.But sadly it doesn't work for me.
>
> My code is as follows:
>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head id="Head1" runat="server">
> <title></title>
> <script type="text/javascript"
> src="OL28/OL28/lib/OpenLayers.js"></script>
> <script type="text/javascript">
>
> var mapview, layer, layer1, map, popup, latlon;
> var highlight_style,wfs_url;
> // this is using WFS from WMS to change the color of a feature in a
> layer
> function load() {
> //OpenLayers.ProxyHost = "proxy.cgi?url=";
> var lon = 77.384;
> var lat = 28.389;
> var zoom = 9;
> map = new OpenLayers.Map('<%=map.ClientID%>', {
> projection: "EPSG:4326",
> units: "dd",
> maxExtent: new OpenLayers.Bounds(76.507859, 27.613907,
> 78.439621, 28.941223)
> });
>
> // layer = new OpenLayers.Layer.WMS("OpenLayers
> WMS",
> // "http://localhost:9000/cgi-bin/mapserv.exe?",
> { map: '../htdocs/Shape/newwr1rec.map', layers: 'STATE', format: 'png' });
> // layer1 = new OpenLayers.Layer.WMS("Rstations",
> // "http://localhost:9000/cgi-bin/mapserv.exe?",
> { map: '../htdocs/Shape/newwr1rec.map', transparent: true, layers:
> 'RailwayStations', format: 'png' });
> //alert(map);
>
> layer = new OpenLayers.Layer.WMS("MyWMS",
> "/cgi-bin/mapserv.exe?map=C:/Program Files/Apache Software
> Foundation/Apache2.2/htdocs/Delhi/Delhi1.map", { layers: 'Adminbndy3',
> transparent: 'true', format: 'image/png' },{
> isBaseLayer:false,
> visibility: true
> });
>
> //map.addLayer(layer);
>
> // var defaultStyle = new OpenLayers.Style({
> // 'pointRadius': 10,
> // 'externalGraphic': '${thumbnail}'
> // });
>
> var ures = new OpenLayers.Layer("ures", {
> isBaseLayer: true
> });
>
> select = new OpenLayers.Layer.Vector("Selection", { styleMap:
> new
> OpenLayers.Style(OpenLayers.Feature.Vector.style["select"])
> });
> hover = new OpenLayers.Layer.Vector("Hover");
> map.addLayers([layer,hover,select,ures ]);
>
>
> control = new OpenLayers.Control.GetFeature({
> protocol: OpenLayers.Protocol.WFS.fromWMSLayer(layer, {
> featurePrefix: 'ms',
> geometryName: 'msGeometry',
> featureType: 'Adminbndy3'
> }),
> box: true,
> hover: true,
> multipleKey: "shiftKey",
> toggleKey: "ctrlKey"
>
>
> });
>
>
> control.events.register("featureselected", this, function(e) {
> select.addFeatures([e.feature]);
> });
> control.events.register("featureunselected", this, function(e)
> {
> select.removeFeatures([e.feature]);
> });
> control.events.register("hoverfeature", this, function(e) {
> hover.addFeatures([e.feature]);
> });
> control.events.register("outfeature", this, function(e) {
> hover.removeFeatures([e.feature]);
> });
> map.addControl(control);
> control.activate();
>
> // map.addControl(new OpenLayers.Control.LayerSwitcher());
> // map.addControl(new OpenLayers.Control.MousePosition());
>
> map.setCenter(lon,lat,zoom);
>
> }
>
> </script>
>
> <style type="text/css">
> #Select1
> {
> width: 107px;
> }
> </style>
>
> </head>
> <body onload="load()">
> <form id="form1" runat="server">
> <div id="map" runat="server" style="width:600px;height:600px">
>
> </div>
> <select id="Select1" onchange="chfeatcolor()">
> <option value="Selected">Choose One</option>
> <option value="1">Gautam Buddha Nagar</option>
> <option value="2">Ghaziabad</option>
> <option value="3">Faridabad</option>
> </select>
> <input type="text" id="txt1" />
> </form>
>
> </body>
> </html>
>
> I got a few errors but after making some changes I now get a blank page.
>
> Pls help.
>
>
More information about the Users
mailing list