terriajs icon indicating copy to clipboard operation
terriajs copied to clipboard

GeoPlatform CSW doesn't work

Open stevage opened this issue 9 years ago • 4 comments

https://cms.geoplatform.gov/help/index.html?catalog_service_for_the_web_cs.htm

The endpoint http://catalog.data.gov/csw should work but:

The CSW server reported an error:

Invalid Constraint: Invalid Filter request: Invalid PropertyName: OnlineResourceType. 'OnlineResourceType'

For some reason, the web request is getting made with no parameters (no service=csw even).

stevage avatar May 03 '16 13:05 stevage

There are no query parameters because we're interacting with the server via POST rather than GET. The server is responding with: image GetCapabilities (https://catalog.data.gov/csw?request=GetCapabilities&service=CSW) is fine, though, so it's worth a bit more investigation into why this server doesn't like TerriaJS's CSW requests.

kring avatar Feb 16 '18 12:02 kring

the initial query to csw has a filter OnlineResourceType='wms', however OnlineResourceType is not a filter property on for example pycsw, see also https://github.com/geopython/pycsw/issues/867

https://github.com/TerriaJS/terriajs/blob/ccd229665794dcd91f023cb0a01e8bc6a4bd6a3d/lib/Models/Catalog/Ows/CswGetRecordsTemplate.xml#L13

terriajs could better check in getcapabilities which filter properties are supported

pvgenuchten avatar May 31 '23 13:05 pvgenuchten

I found workaround at pycsw side, you can configure OnlineResourceType as an additional queryable in pycsw/config.py

pvgenuchten avatar Jun 02 '23 08:06 pvgenuchten

hi @pvgenuchten

I briefly looked into this. The file you've found is the default CSW GetRecords template. However, it is possible to configure a custom GetRecordsTemplate for a CSW group. For example, this will return only the CSW items which mention "SoilGrids":

{
      "id": "Catalogue-rwanda",
      "type": "csw-group",
      "name": "LSC Catalogue rwanda",
      "url": "https://rwanda.lsc-hubs.org/cat/csw",
      "getRecordsTemplate": "<csw:GetRecords xmlns:csw=\"http://www.opengis.net/cat/csw/2.0.2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ogc=\"http://www.opengis.net/ogc\" outputSchema=\"http://www.opengis.net/cat/csw/2.0.2\" outputFormat=\"application/xml\" version=\"2.0.2\" service=\"CSW\" resultType=\"results\" startPosition=\"{startPosition}\" maxRecords=\"100\" 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:PropertyIsLike wildCard=\"*\" singleChar=\"?\" escapeChar=\"\\\\\"><ogc:PropertyName>apiso:AnyText</ogc:PropertyName><ogc:Literal>*SoilGrids*</ogc:Literal></ogc:PropertyIsLike></ogc:Filter></csw:Constraint></csw:Query></csw:GetRecords>"
}

Please note the startPosition placeholder in the XML template string (startPosition=\"{startPosition}\"), this is required for incremental paging of the CSW results. For details, please see this documentation page.

sidneygijzen avatar Jan 29 '25 16:01 sidneygijzen