Bug report #17120

Missing namespace declaration when searching by bounding box

Added by Andy Debrouwer about 7 years ago. Updated about 7 years ago.

Status:Closed
Priority:Normal
Assignee:Tom Kralidis
Category:MetaSearch Catalogue Client
Affected QGIS version:2.8.6 Regression?:No
Operating System:Ubuntu LTS 16.04.3 Easy fix?:Yes
Pull Request or Patch supplied:No Resolution:wontfix
Crashes QGIS or corrupts data:No Copied to github as #:25019

Description

When searching by bounding box with the MetaSearch plugin, the resulting GetRecords requests is missing the namespace declaration for ows:BoundingBox property.

ghere is an example Getrecords request generated by the MetaSearch plugin

<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" outputSchema="http://www.opengis.net/cat/csw/2.0.2" outputFormat="application/xml" version="2.0.2" service="CSW" resultType="results" maxRecords="20" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">
    <csw:Query typeNames="csw:Record">
        <csw:ElementSetName>full</csw:ElementSetName>
        <csw:Constraint version="1.1.0">
            <ogc:Filter>
                <ogc:And>
                    <ogc:BBOX>
                        <ogc:PropertyName>ows:BoundingBox</ogc:PropertyName>
                        <gml:Envelope>
                            <gml:lowerCorner>0 0</gml:lowerCorner>
                            <gml:upperCorner>180 90</gml:upperCorner>
                        </gml:Envelope>
                    </ogc:BBOX>
                    <ogc:PropertyIsLike wildCard="%" singleChar="_" escapeChar="\">
                        <ogc:PropertyName>csw:AnyText</ogc:PropertyName><ogc:Literal>%world%</ogc:Literal>
                    </ogc:PropertyIsLike>
                </ogc:And>
            </ogc:Filter>
        </csw:Constraint>
    </csw:Query>
</csw:GetRecords>

As you can see, this GetRecords request contains a ogc:Filter constraint with a BBOX condition. The value of the PropertuName of this BBOX condition has is ows:BoundingBox. However this request contains no xmlns:ows="..." declaration.

History

#1 Updated by Giovanni Manghi about 7 years ago

  • Category changed from Python plugins to MetaSearch Catalogue Client
  • Status changed from Open to Feedback

QGIS 2.8.6?

#2 Updated by Tom Kralidis about 7 years ago

Thanks for the report. I am unable to reproduce (worksforme). I don't have a copy of QGIS 2.8.6 handy to further test. Are you able to upgrade to a stable release version and test/try again?

#3 Updated by Tom Kralidis about 7 years ago

  • Assignee set to Tom Kralidis

#4 Updated by Andrew Wils about 7 years ago

I've been able to reproduce this using QGIS 2.8.13, simply by opening the Search tab, clicking on Map extent and then on Search.
I believe the cleanup_namespaces command invoked in csw.py removes the ows namespace because the namespace is only used as a property name, not in attributes or elements.
So the bug probably goes away once you include any OWS attribute or element in the GetRecords call.

#5 Updated by Tom Kralidis about 7 years ago

  • Status changed from Feedback to Closed
  • Resolution set to wontfix

Given this is 2.8.6 I would say your best bet here is to either upgrade QGIS or update your underlying OWSLib install (which is the underlying issue [which has been fixed long ago]).

#6 Updated by Andrew Wils about 7 years ago

Tom Kralidis wrote:

Given this is 2.8.6 I would say your best bet here is to either upgrade QGIS or update your underlying OWSLib install (which is the underlying issue [which has been fixed long ago]).

As I said earlier, I reproduced this using 2.8.13.
I also pointed to what I believe is the location of the bug, in the csw.py file of that upgraded QGIS release, and also in the latest version of csw.py found on GitHub.

It seems the file already has a partial bugfix, because after calling cleanup_namespaces, it re-inserts the namespace used in the typeNames. However, an ows bounding box is never included in the typenames attribute, so that namespace will still be lost.
I will log an issue for it in the owslib project then.

#7 Updated by Tom Kralidis about 7 years ago

I'm still unable to reproduce. Can you provide a CSW which demonstrates that the request is problematic?

#8 Updated by Tom Kralidis about 7 years ago

To clarify, I've fixed this in OWSLib, but unable to reproduce how this would be an error in MetaSearch.

Also available in: Atom PDF