Bug report #16569
Incorrect search bounding box when using epsg:4326
|Category:||MetaSearch Catalogue Client|
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||All||Easy fix?:||Yes|
|Pull Request or Patch supplied:||No||Resolution:||fixed/implemented|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||24471|
When the user makes a query to a CSW server using the current map extent as a bounding box, the resulting
gml:Envelope XML element lacks the
srsName attribute, therefore leaving room for interpretation by the catalogue server.
Metasearch creates a bounding box with a list of coordinates that are:
which results in an XML fragment like:
<ogc:BBOX> <ogc:PropertyName>ows:BoundingBox</ogc:PropertyName> <gml:Envelope> <gml:lowerCorner>lower_left_x lower_left_y</gml:lowerCorner> <gml:upperCorner>upper_right_x upper_right_y</gml:upperCorner> </gml:Envelope> </ogc:BBOX>
Due to the nature of GML, since the resulting XML element does not specify a coordinate reference system, it is up to the catalogue that is being queried to decide what CRS to use and how to interpret the values in the bounding box.
A pycsw catalogue will default to interpret the
gml:Envelope using the CRS specified by
urn:x-ogc:def:crs:EPSG:6.11:4326. This CRS definition specifies that coordinates are to be intepreted as YX (lat lon) and not as XY (lon lat). This means that the bounding box specified in QGIS is not interpreted correctly by a pycsw server.
This problem is specially relevant for areas over Asia, that are above 90º longitude because they cause the server to not find any records, as it thinks the client is requesting a bbox that is beyond 90º latitude.
- Include the
srsNameattribute in the
gml:Envelopeelement with a CRS that specifies XY as its axis order - This is the preferred solution, as it should work on any CSW server. It eliminates the need for the server to have to resort to some nonstandard default CRS.
- Switch the coordinate pairs in the
gml:upperCornerelements so that they are YX by default - This is an easier fix that will make metasearch work OK against a pycsw server. However, it may break it for other CSW implementations.