{"id":477,"date":"2010-05-07T21:34:28","date_gmt":"2010-05-08T01:34:28","guid":{"rendered":"http:\/\/www.kralidis.ca\/blog\/?p=477"},"modified":"2010-05-07T22:00:49","modified_gmt":"2010-05-08T02:00:49","slug":"owslib-csw-updates-and-implementation-thoughts","status":"publish","type":"post","link":"https:\/\/www.kralidis.ca\/blog\/2010\/05\/07\/owslib-csw-updates-and-implementation-thoughts\/","title":{"rendered":"OWSLib CSW Updates and Implementation Thoughts"},"content":{"rendered":"<p>I&#8217;ve had some time to work on CSW support in <a title=\"OWSLib\" href=\"http:\/\/trac.gispython.org\/lab\/wiki\/OwsLib\">OWSLib<\/a> in the last few days.\u00a0 Some thoughts and updates:<\/p>\n<h3>FGDC Support Added<\/h3>\n<p>Some CSW endpoints out there serve up GetRecords responses in <a title=\"FGDC CSDGM\" href=\"http:\/\/www.fgdc.gov\/metadata\/csdgm\/index_html\">FGDC CSDGM<\/a> format.\u00a0 This has now been <a title=\"added\" href=\"http:\/\/trac.gispython.org\/lab\/ticket\/223\">added<\/a> to <a title=\"trunk\" href=\"http:\/\/trac.gispython.org\/lab\/browser\/OWSLib\/trunk\/owslib\/fgdc.py\">trunk<\/a> (mandatory elements + eainfo).\u00a0 Note that csw:Record (DMCI + ows:BoundingBox) and ISO 19139 are already supported.\u00a0 One tricky bit here is that FGDC was\/is mostly implemented without a namespace, which CSW requires as an outputSchema parameter value.\u00a0 I&#8217;ve used http:\/\/www.fgdc.gov for now.<\/p>\n<p>Both FGDC and ISO (moreso ISO) have deep and complex content models, so if there are elements that you don&#8217;t see supported in OWSLib, please file an feature request ticket in trac, and I&#8217;ll make sure to implement (and add to the doctests).<\/p>\n<h3>Metadata Identifiers are Important!<\/h3>\n<p>When parsing GetRecords requests, we store records in a Python dict,  using \/gmd:MD_Metadata\/gmd:fileIdentifier (for ISO),  \/csw:Record\/dc:identifier (for CSW&#8217;s baseline) or  \/metadata\/idinfo\/datasetid (for FGDC).\u00a0 Some responses return metadata without these ids for whatever reason.\u00a0 This sets the dict key to Python&#8217;s None type, which ends up overwriting the dict key&#8217;s entry.\u00a0 Not good.\u00a0 I <a title=\"implemented\" href=\"http:\/\/trac.gispython.org\/lab\/ticket\/219\">implemented<\/a> a <a title=\"fix\" href=\"http:\/\/trac.gispython.org\/lab\/changeset\/1629\">fix<\/a> to set a random, non-persistent identifier so as not to lose data.<\/p>\n<p>Of course, the best solution here would be for providers to set identifiers accordingly from the start.\u00a0 Then again, what happens when CSW endpoints harvest other CSWs and identifiers are the same?\u00a0 Perhaps a namespace of some sort for the CSW would help.\u00a0 This would be an interesting interoperability experiment.<\/p>\n<h3>Harvest Support Added<\/h3>\n<p>I <a title=\"implemented\" href=\"http:\/\/trac.gispython.org\/lab\/ticket\/221\">implemented<\/a> a <a title=\"first pass\" href=\"http:\/\/trac.gispython.org\/lab\/changeset\/1630\">first pass<\/a> of supporting Harvest operations.\u00a0 CSW endpoints usually require authentication here, which may vary by the implementation.\u00a0 Therefore, I&#8217;ve left this logic out of OWSLib as it&#8217;s not part of the standard per se.<\/p>\n<h3>Transaction Support Coming<\/h3>\n<p><a title=\"Sebastian Benthall\" href=\"http:\/\/opengeo.org\/about\/team\/sebastian.benthall\/\">Sebastian Benthall<\/a> of <a title=\"OpenGeo\" href=\"http:\/\/www.opengeo.org\/\">OpenGeo<\/a> has indicated that they are using OWSLib&#8217;s CSW support for some of their projects (awesome!), and has kindly submitted a <a title=\"patch\" href=\"http:\/\/trac.gispython.org\/lab\/ticket\/218\">patch<\/a> for an optional element issue (thanks Sebastian!).\u00a0 He also indicated that Transaction support would be of interest, so I&#8217;ve <a title=\"started\" href=\"http:\/\/trac.gispython.org\/lab\/ticket\/222\">started<\/a> to think about this one.\u00a0 As with the Harvest operation, Transaction support also requires some sort of authentication, which we&#8217;ll leave to the client implementation.\u00a0 Most of the work will be with marshalling the request, as response handling is very similar to Harvest responses.<\/p>\n<p>Give it a go, submit bugs and enhancements to the <a title=\"OWSLib trac\" href=\"http:\/\/trac.gispython.org\/lab\/wiki\/OwsLib\">OWSLib trac<\/a>.\u00a0 Enjoy!<\/p>\n<link rel=\"stylesheet\" href=\"http:\/\/cdn.leafletjs.com\/leaflet-0.5\/leaflet.css\" \/>\n<!--[if lte IE 8]>\n  <link rel=\"stylesheet\" href=\"http:\/\/cdn.leafletjs.com\/leaflet-0.5\/leaflet.ie.css\" \/>\n<![endif]-->\n<script src=\"http:\/\/cdn.leafletjs.com\/leaflet-0.5\/leaflet.js\"><\/script>\n<style type=\"text\/css\">#map477 { width: 300px; height: 200px; }<\/style>\n\n<div id=\"map477\"><\/div>\n<script type=\"text\/javascript\">\n  var map477 = L.map('map477').setView([43.620495, -79.513198], 10);\n  L.tileLayer('http:\/\/{s}.tile.osm.org\/{z}\/{x}\/{y}.png', {\n      attribution: '&copy; <a href=\"http:\/\/osm.org\/copyright\">OpenStreetMap<\/a> contributors'\n  }).addTo(map477);\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve had some time to work on CSW support in OWSLib in the last few days.\u00a0 Some thoughts and updates: FGDC Support Added Some CSW endpoints out there serve up GetRecords responses in FGDC CSDGM format.\u00a0 This has now been added to trunk (mandatory elements + eainfo).\u00a0 Note that csw:Record (DMCI + ows:BoundingBox) and ISO [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7,3,11],"tags":[],"class_list":["post-477","post","type-post","status-publish","format-standard","hentry","category-geospatial","category-open-source","category-technology","category-web"],"_links":{"self":[{"href":"https:\/\/www.kralidis.ca\/blog\/wp-json\/wp\/v2\/posts\/477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kralidis.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kralidis.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kralidis.ca\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kralidis.ca\/blog\/wp-json\/wp\/v2\/comments?post=477"}],"version-history":[{"count":6,"href":"https:\/\/www.kralidis.ca\/blog\/wp-json\/wp\/v2\/posts\/477\/revisions"}],"predecessor-version":[{"id":481,"href":"https:\/\/www.kralidis.ca\/blog\/wp-json\/wp\/v2\/posts\/477\/revisions\/481"}],"wp:attachment":[{"href":"https:\/\/www.kralidis.ca\/blog\/wp-json\/wp\/v2\/media?parent=477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kralidis.ca\/blog\/wp-json\/wp\/v2\/categories?post=477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kralidis.ca\/blog\/wp-json\/wp\/v2\/tags?post=477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}