[OpenLayers-Users] WFS broken in 2+

Christopher Schmidt crschmidt at crschmidt.net
Tue Aug 22 06:54:26 CDT 2006


On Mon, Aug 21, 2006 at 11:58:59PM -0400, chrislist at narx.net wrote:
> There seems to be a few issues with WFS which i wasn't able to resolve with
> both the RC1 and the latest SVN revision.
> 
> Bug 1. Small typo?
> 
> Line 81 of Tile/WFS.js
> 
> var url = this.urls[i] + OpenLayers.Util.getParameterString(params);
> 
> should read 
> 
> var url = this.urls[i] + "&" + OpenLayers.Util.getParameterString(params);
> 
> as getParameterString() only appends the ampersand. Currently the WFS
> request results in something like SRS=EPSG:4326BBOX=.... nice and easy fix
Thanks, this has been fixed in the 2.0 branch. Hopefully 2.0-rc2 will be
coming out today (if I can fix some of the more serious IE issues), at
which point the rc2 will contain your fixes.

> 2. The ProxyHost script which comes bundled i have replaced with a php/curl
> solution. I know most dont usually have access to python as cgi so the
> following might be of some use (very basic, no hostname checking so be
> careful)
> 
> <?php
> // PHP Proxy example for Openlayers
> // OL only needs to support GET calls
> $url = $_GET['url'];
> $parseurl = urldecode($url);
> // Open the Curl session (with support for services over SSL
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_POST,1);
> curl_setopt($ch, CURLOPT_URL,$parseurl);
> curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);
> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);  
> $xml=curl_exec ($ch);
> curl_close ($ch);
> // OL expects text/XML to be able to parse into the DOM. Set the header
> accordingly
> header("Content-Type: text/xml");
> echo $xml;
> ?>
> 
> After sorting out the above issues, OL does not render the markers as
> expected. No exceptions are being thrown, there is definately
> featureMembers containing points being returned ... but nothing is
> happening :/



> Ideas that cannot be confirmed:
> 
> a. The DOM traversal looks for an element called Point (Line 50
> Feature/WFS.js). Does the prefix (eg. gml:Point) need to be added? I tried
> but did not seem to change anything ..  

It shouldn't be. IE and Firefox both support getElementsByTagName
without a prefix, and the spec allows this. Safari does not follow this,
and requires you to instead use getElementsByTagNameNS, but I'm assuming
that you're not in Safari.

> b. Is there anyway to use WFS in a manner similar to WMS.Untiled? Tiling
> the WFS requests is not exactly beneficial in the same way it is for WMS
> *wishlist*

I think this is a good idea, to the extent that I've seen enough
problems otherwise that I want to implement it Sooner Rather Than Later.
I'm going to try and get it on schedule -- I'll send an email when I
know how soon I can get this implemented.

> Any ideas? I'm really keen to show a clientside WFS solution (even if it is
> just for points)

It does seem that something is broken here... I'm not sure how the
existing code ever worked (but I know that it did!)

It seems that it was looking at the Point element, and attempting to get
TextContent out of that. However, in the one WFS example I have:


http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?TYPENAME=OWLS&MAXFEATURES=10&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&SRS=EPSG:4326&BBOX=-135,45,-90,90

The Point stores its data inside gml:coordinates inside the Point. This
means that the old logic wouldn't work. 

I've fixed the example by changing this behavior with revision 1327.
However, in general, you will probably need to create your own Feature
subclass of WFS in order to work with GML: because of the wide level of
extensibility that GML provides, it is easily possible to create valid
GML which is hard or impossible to parse in a programmatic fashion. This
should at least get you started, even if you do need to create your own
Feature class, since at least now something (examples/wfs.html) works!

Thanks for the bug reports,
-- 
Christopher Schmidt
Web Developer


More information about the Users mailing list