[OWSLib-devel] how to restrict csw query to service only

Tom Kralidis tomkralidis at gmail.com
Sun Dec 14 05:21:11 PST 2014


On Sun, Dec 14, 2014 at 5:43 AM, Jachym Cepicky
<jachym.cepicky at gmail.com> wrote:
> Hi,
> I'm really new to the csw topic, so please be patient with me. Also, as far
> as I understand, INSPIRE discovery service is not specified well in some
> points, which can lead to bad result's I might get from the server I'm
> trying to work with.
>
> The server is national INSPIRE catalogue of Czech republic running at
> http://geoportal.gov.cz/php/micka/csw/index.php
>
> From OWSLib/csw documentation it's quite clear, how to use "AnyText" and
> "BoundingBox" restriction.
>
> Questions:
>
> 1. It is not quite clear to me, how to restrict query to particular record
> type ("Data" or "Service"), how to specify ServiceType ('WMS' or 'view')?
>

Not sure.  I've seen both examples, as well as 'OGC:WMS', etc.  Does
(should?) the INSPIRE have a controlled vocabulary defined?

> 2. When I try to restrict the query to particular organisation, seems that
> OWSLib is not counting with special characters ?
>
>>>> aopk_query = PropertyIsEqualTo('csw:MetadataContact', 'Agentura ochrany
>>>> přírody a krajiny České republiky')
>>>> cenia.getrecords2([aopk_query])
>
> I get following error:
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/local/lib/python2.7/dist-packages/owslib/csw.py", line 341, in
> getrecords2
>     node2.append(flt.setConstraintList(constraints))
>   File "/usr/local/lib/python2.7/dist-packages/owslib/fes.py", line 143, in
> setConstraintList
>     return self.setConstraint(constraints[0])
>   File "/usr/local/lib/python2.7/dist-packages/owslib/fes.py", line 117, in
> setConstraint
>     self._root.append(constraint.toXML())
>   File "/usr/local/lib/python2.7/dist-packages/owslib/fes.py", line 264, in
> toXML
>     etree.SubElement(node0, util.nspath_eval('ogc:Literal',
> namespaces)).text = self.literal
>   File "lxml.etree.pyx", line 953, in lxml.etree._Element.text.__set__
> (src/lxml/lxml.etree.c:45142)
>   File "apihelpers.pxi", line 684, in lxml.etree._setNodeText
> (src/lxml/lxml.etree.c:20505)
>   File "apihelpers.pxi", line 1393, in lxml.etree._utf8
> (src/lxml/lxml.etree.c:26656)
> ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL
> bytes or control characters
>
> Any hints?
>

Looks like a bug.  I've opened
https://github.com/geopython/OWSLib/issues/202.  Thanks!

..Tom


> Thank you
>
> Jachym
>
>
> _______________________________________________
> OWSLib-devel mailing list
> OWSLib-devel at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/owslib-devel


More information about the OWSLib-devel mailing list