Hello,

Here's a simple CSW GetRecords request, specifying a bounding box:

    var filterBoundingBox = new OpenLayers.Filter.Comparison({
      type: OpenLayers.Filter.Spatial.BBOX,
      property: "ows:BoundingBox",
      value: bbox
    });

    var options = {
      resultType: "results",
      startPosition: 1,
      maxRecords: 20,
      outputFormat: "application/xml",
      outputSchema: "http://www.isotc211.org/2005/gmd";,
      Query: {
        ElementSetName: {
          value: "full"
        },
        Constraint: {
          version: "1.1.0",
          Filter: filterBoundingBox
        }
      }
    };

    var format = new OpenLayers.Format.CSWGetRecords();
    console.log(format.write(options));

Which shows on the console :

<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2";
                    service="CSW"
                    version="2.0.2"
                    resultType="results"
                    outputFormat="application/xml"
                    outputSchema="http://www.isotc211.org/2005/gmd";
                    startPosition="1"
                    maxRecords="20">
<csw:Query typeNames="csw:Record">
<csw:ElementSetName>full</csw:ElementSetName>
<csw:Constraint version="1.1.0">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc";>
<ogc:BBOX>
<ogc:PropertyName>ows:BoundingBox</ogc:PropertyName>
<gml:Envelope xmlns:gml="http://www.opengis.net/gml";>
<gml:lowerCorner>-8.623046875 25.8935546875</gml:lowerCorner>
<gml:upperCorner>13.349609375 47.8662109375</gml:upperCorner>
</gml:Envelope>
</ogc:BBOX>
</ogc:Filter>
</csw:Constraint>
</csw:Query>
</csw:GetRecords>

The problem is that the "ows" namespace is not declared anywhere, be it on the <ogc:Filter> element or the root element.
Which generates error on the CSW server side.

Again, if I want to have a filter like:

    var filterSubject = new OpenLayers.Filter.Comparison({
      type: OpenLayers.Filter.Comparison.LIKE,
      property: "apiso:Subject",
      value: "*qwerty*"
    });

How/where am I supposed to declare the "apiso" namespace?
Of course, just before sending the request of the wire, I can manually modify the XML string in JavaScript, but is it the "right-way-to-do-it"?

Thanks,

--
Damiano ALBANI

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to