<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Firstly, thank you Alexandre for helping to point me to the right
point in the source. I had been debugging with firebug and was able
to locate the point at which the points were being parsed in
OL.Format.GML.v3.js, but was stumped as to why the layer.features
continued to remain empty.<br>
<br>
Secondly, it appears this problem existed at two separate points.
The first point was that I was not specifying the geometryName in my
initial script. Since my geometry name was not "the_geom" (which is
the default value) by "msGeometry" nothing was being parsed
correctly. <br>
<br>
When I added the geometryName property I also (foolishly) added a
"version" property and set this to 1.1.0. At this point, when I
stepped through the code I could clearly see the points being
parsed, but nothing would render. After removing "version" (or
setting it to 1.0.0) my vectors rendered.<br>
<br>
Thank you again Alexandre, you helped me to understand that I can
set the wfs_namespace_prefix in my map, which may well be a smarter
approach than having to specify it in the js. I will explore the
merits of this option.<br>
<br>
Cheers!<br>
<br>
Mark K. Zanfardino<br>
<br>
On 06/08/2011 08:47 AM, Alexandre Dube wrote:
<blockquote cite="mid:4DEF999E.8020201@mapgears.com" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
Hi,<br>
<br>
This seems to be a matter of feature namespace. In OpenLayers,
XML is read using the namespaces of a node as the way to detect
the according reader for it. If not set in the protocol,
OpenLayers sets "feature" as default prefix for feature nodes. In
MapServer, the default value outputed in the GML is "ms" as you
can see in yours. You can either adjust OpenLayers to your
MapServer settings [1] or the opposite [2] in order to read the
nodes accordingly.<br>
<br>
[1] set feature prefix and namespace in your protocol (OpenLayers)
according to MapServer settings<br>
<br>
protocol: new OpenLayers.Protocol.WFS({<br>
url: mapPath,<br>
featureType: "tenszones",<br>
featurePrefix: "ms",<br>
featureNS: "<a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="http://mapserver.gis.umn.edu/mapserver">http://mapserver.gis.umn.edu/mapserver</a>"<br>
}),<br>
<br>
[2] or set your feature namespace to OpenLayers default value in
your mapfile (in your MAP, METADATA tag):<br>
<br>
"wfs_namespace_prefix" "feature"<br>
"wfs_namespace_uri" <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E" href="http://localhost">"http://localhost"</a><br>
<br>
Before making any changes, you could use firebug with an
uncompressed version of OpenLayers (2.10) and set a breakpoint in
./lib/OpenLayers/Format/XML.js on line 621 :<br>
var group = this.readers[node.namespaceURI ?
this.namespaceAlias[node.namespaceURI]: this.defaultPrefix];<br>
<br>
Inspect the elements there until you reach your node that doesn't
get read properly and you'll see why it isn't and how it works as
well.<br>
<br>
HTH,<br>
<br>
Alexandre<br>
<br>
<br>
On 11-06-08 11:12 AM, Mark K. Zanfardino wrote:
<blockquote cite="mid:4DEF9172.4030800@gmail.com" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
OpenLayers version 2.10 <br>
MapServer version 5.6.6 <br>
<br>
Goal: Render vector layer based on WFS protocol<br>
<br>
I'm trying to understand why a vector layer will not render on
my map. I can clearly see the layer in the layerSwitcher control
so I presume the layer is being presented, but there are no
actual features rendered.<br>
<br>
The vector layer is defined using a WFS protocol:<br>
<blockquote>tens = new OpenLayers.Layer.Vector("TENS", <br>
{<br>
strategies: [new OpenLayers.Strategy.BBOX()],<br>
protocol: new OpenLayers.Protocol.WFS({<br>
url: mapPath,<br>
featureType: "tenszones",<br>
}),<br>
styleMap: new OpenLayers.StyleMap({<br>
strokeWidth: 3,<br>
strokeColor: "#333333"<br>
}),<br>
filter: new OpenLayers.Filter.Logical({<br>
type: OpenLayers.Filter.Logical.NOT,<br>
filters: [<br>
new OpenLayers.Filter.Comparison({<br>
type: OpenLayers.Filter.Comparison.EQUAL_TO,<br>
property: "name",<br>
value: "County0"<br>
})<br>
]<br>
})<br>
},<br>
{<br>
isBaseLayer: false,<br>
buffer: 0<br>
}<br>
);<br>
</blockquote>
When I watch the page load I can clearly see the XML results
from the WFS call (see XML output) but no features are rendered
on the map. I'm following from the 'WFS Protocol and Filter'
example. Any help would be appreciated.<br>
<br>
<?xml version='1.0' encoding="ISO-8859-1" ?><br>
<wfs:FeatureCollection<br>
xmlns:ms=<a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="http://mapserver.gis.umn.edu/mapserver">"http://mapserver.gis.umn.edu/mapserver"</a><br>
xmlns:wfs=<a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="http://www.opengis.net/wfs">"http://www.opengis.net/wfs"</a><br>
xmlns:gml=<a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="http://www.opengis.net/gml">"http://www.opengis.net/gml"</a><br>
xmlns:ogc=<a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="http://www.opengis.net/ogc">"http://www.opengis.net/ogc"</a><br>
xmlns:xsi=<a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a><br>
xsi:schemaLocation="<a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="http://www.opengis.net/wfs">http://www.opengis.net/wfs</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd</a>
<br>
<a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="http://mapserver.gis.umn.edu/mapserver">http://mapserver.gis.umn.edu/mapserver</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://localhost/cgi-bin/mapserv?map=/home/mark/htdocs/sandbox/contra_costa/mapdata/cws.map&amp;SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=tenszones&amp;OUTPUTFORMAT=XMLSCHEMA">http://localhost/cgi-bin/mapserv?map=/home/mark/htdocs/sandbox/contra_costa/mapdata/cws.map&amp;SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=tenszones&amp;OUTPUTFORMAT=XMLSCHEMA</a>"><br>
<gml:boundedBy><br>
<gml:Box srsName="EPSG:4326"><br>
<gml:coordinates>-122.430673,37.902872
-121.783758,38.058186</gml:coordinates><br>
</gml:Box><br>
</gml:boundedBy><br>
<gml:featureMember><br>
<ms:tenszones fid="tenszones.2"><br>
<gml:boundedBy><br>
<gml:Box srsName="EPSG:4326"><br>
<gml:coordinates>-121.882119,38.004151
-121.822493,38.034986</gml:coordinates><br>
</gml:Box><br>
</gml:boundedBy><br>
<ms:msGeometry><br>
<gml:Polygon srsName="EPSG:4326"><br>
<gml:outerBoundaryIs><br>
<gml:LinearRing><br>
<gml:coordinates>-121.826546,38.024671
-121.825545,38.018151 -121.822493,38.015989
-121.832033,38.004151 -121.847393,38.007365
-121.876296,38.018261 -121.875579,38.022347
-121.882119,38.024341 -121.880209,38.032456
-121.878309,38.034986 -121.826546,38.024671
</gml:coordinates><br>
</gml:LinearRing><br>
</gml:outerBoundaryIs><br>
</gml:Polygon><br>
</ms:msGeometry><br>
<ms:gid>2</ms:gid><br>
<ms:area>0.00104289122555201</ms:area><br>
<ms:perimeter>0.147388060113902</ms:perimeter><br>
<ms:name>DOW0</ms:name><br>
</ms:tenszones><br>
</gml:featureMember><br>
<gml:featureMember><br>
<ms:tenszones fid="tenszones.3"><br>
<gml:boundedBy><br>
<gml:Box srsName="EPSG:4326"><br>
<gml:coordinates>-121.837932,37.999340
-121.819430,38.024672</gml:coordinates><br>
</gml:Box><br>
</gml:boundedBy><br>
<ms:msGeometry><br>
<gml:Polygon srsName="EPSG:4326"><br>
<gml:outerBoundaryIs><br>
<gml:LinearRing><br>
<gml:coordinates>-121.826535,38.024672
-121.819800,38.022000 -121.819430,38.004870
-121.821310,37.999340 -121.837932,38.003598
-121.836350,38.005070 -121.832027,38.004150
-121.822495,38.015991 -121.825510,38.018100
-121.826535,38.024672 </gml:coordinates><br>
</gml:LinearRing><br>
</gml:outerBoundaryIs><br>
</gml:Polygon><br>
</ms:msGeometry><br>
<ms:gid>3</ms:gid><br>
<ms:area>0.000183226789886248</ms:area><br>
<ms:perimeter>0.0794914873797834</ms:perimeter><br>
<ms:name>DOW1</ms:name><br>
</ms:tenszones><br>
</gml:featureMember><br>
</wfs:FeatureCollection>
<pre wrap=""><fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Alexandre Dubé
Mapgears
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="http://www.mapgears.com">www.mapgears.com</a>
</pre>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a>
</pre>
</blockquote>
</body>
</html>