[gdal-dev] How to give additional WFS parameters right?

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Mon Aug 13 01:26:41 PDT 2012


Even Rouault <even.rouault <at> mines-paris.org> writes:

> 
> 
> Le samedi 04 août 2012 17:42:54, Jukka Rahkonen a écrit :
> > Ok,
> > Inserting WFS source between "" helped with command line (I am on
> > Windows as usual").
> > 
> > ogr2ogr -f GML test2.txt "wfs:http://hip.latuviitta.org/cgi-bin/
> > tinyows?SERVICE=WFS&VERSION=1.1.0&TYPENAME=
> > lv:hki_parkkilippuautomaatit&MAXFEATURES=2"
> > 
> > The XML definition file overwrite problem is left.
> 
> I think the problem is just that you didn't XML-escaped the value of the URL
element, namely the & character must be written as & 
> 
> I've updated the doc to make that more obvious (and fix the example where it
wasn't done before OPTIONNAL_PARAMETER2 ) 

Great. It was not obvious for me but by using the & format the extra
parameters in XML definition file works fine.

I found also another not totally obvious demand when writing the XML file. The
value of TYPENAME must include the namespace part.
This setting works
<URL>http://hip.latuviitta.org/cgi-bin/tinyows?
TYPENAME=lv:municipalities&MAXFEATURES=2</URL>

But this lazy written definition without namespace does not
<URL>http://hip.latuviitta.org/cgi-bin/tinyows?
TYPENAME=municipalities&MAXFEATURES=2</URL>

What makes it not obvious is that namespace is not needed if command is sent
directly without using the XML definition file
ogrinfo "wfs:http://hip.latuviitta.org/cgi-bin/tinyows?maxfeatures=2" 
municipalities

If behaviour cannot be changed (or is not wise to change) so that namespace is
not necessary then it would be good to edit documentation a little bit:
Note: the URL must be XML-escaped, for example the & character must be written
as & and the TYPENAME parameter must be written with the namespase as
ns:typename

Finally, could it be so that a list of values is not properly supported as
TYPENAME or am I writing it somehow wrong again? Ogrinfo does not find any
layers if I write the following into XML file, instead of two layers as I 
expected.

<URL>http://hip.latuviitta.org/cgi-bin/tinyows?TYPENAME=lv:mml_railway,lv:municipalities</URL>

-Jukka Rahkonen-



More information about the gdal-dev mailing list