Graeme,
I haven't experimented much with the WFS code, but we've had this
problem (or similar) with WMS and WCS in the past. There is actually a
(fairly new) method in the utils directory called 'openURL' which owslib
should now use for opening all urls as it does various checks for things
like question marks. However, it looks like we didn't get as far as
migrating the WFS code to use this new method.
If you have the time could you try and replace your proposed fix with
the following and see if that also fixes the problem in your case:
from owslib.util import openURL
u = openURL(base_url, data, method)
Much appreciated,
Dom
On 14/10/10 11:59, Graeme McFerren wrote:
I am having a bit of trouble with attempting a GetFeature Request
against a Geoserver 2.0.1 WFS, using OWSLib Trunk on Ubuntu 10.04/
Python 2.6.5
The following lines in OWSLib/trunk/owslib/feature/wfs100.py seem to be
the problem:
185 if method == 'Post':
186 u = urlopen(base_url, data=data)
187 else:
188 u = urlopen(base_url + data)
Whether GETing or POSTing, the URL's are mangled:
e.g GET -> GET
/geoserver/wfs?request=GetFeatureservice=WFS&maxfeatures=5&propertyname=%2A&request=GetFeature&typename=openafis%3Akruger_burn_blocks&version=1.0.0
e.g. POST -> GET
/geoserver/wfs&service=WFS&maxfeatures=5&propertyname=%2A&request=GetFeature&typename=openafis%3Akruger_burn_blocks&version=1.0.0
and an error is caused (Service Exception in GET case and HTTP 404 in
the case of POST)
For GET, reason seems to be that there is a missing ampersand between
request=GetFeatureservice=WFS
For POST, reason seems to be that the GetFeature method parameter
expects a full '{http://www.opengis.net/wfs}Post' string, yet in Line
185, the unqualified string is tested for, is never found and falls
through to generating a faulty GET request
This statement hack seems to fix the problem for me:
if method == '{http://www.opengis.net/wfs}Post':
u = urlopen(base_url, data=data)
else:
u = urlopen(base_url + '&' + data)
Has this kind of thing been noticed before?
Regards
Graeme McFerren
_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community
_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community