[OWSLib-users] How to mimic this CSW XML Post Query using OWSlib

Tom Kralidis tomkralidis at hotmail.com
Thu Apr 25 15:14:46 PDT 2013


Hi Richard: thanks for the info.  The owslib.csw.getrecords is relatively limited to a few use cases for discovery which cover one comparison operator this way.  It would be valuable to enhance this so any enhancements/pull requests are welcomed.

Having said this, you could just use owslib.csw.getrecords xml argument, which allows you to pass the actual XML POST as a string, which overrides other arguments.  It's not pretty, but useful in cases like this, given the codebase curently.

Hope this helps.

..Tom




> Date: Thu, 25 Apr 2013 16:16:28 -0400
> From: rsignell at usgs.gov
> To: owslib-users at lists.osgeo.org
> Subject: [OWSLib-users] How to mimic this CSW XML Post Query using OWSlib
> 
> I have a CSW endpoint:
> 
> endpoint = 'http://www.ngdc.noaa.gov/geoportal/csw' # NGDC Geoportal
> csw = CatalogueServiceWeb(endpoint, lang='en-US', version='2.0.2', timeout=30)
> 
> and I have a sample POST query:
> 
> xml_string='''
> <?xml version="1.0"?>
> <csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2"
> version="2.0.2" service="CSW" resultType="results"
> outputSchema="http://www.isotc211.org/2005/gmd" startPosition="1"
> maxRecords="1000">
>   <csw:Query typeNames="csw:Record"
> xmlns:ogc="http://www.opengis.net/ogc"
> xmlns:gml="http://www.opengis.net/gml">
>   <csw:ElementSetName>full</csw:ElementSetName>
>   <csw:Constraint version="1.1.0">
>   <ogc:Filter>
>     <ogc:And>
>       <ogc:PropertyIsEqualTo>
>         <ogc:PropertyName>sys.siteuuid</ogc:PropertyName>
>         <ogc:Literal>{78C0463E-2FCE-4AB2-A9C9-6A34BF261F52}</ogc:Literal>
>       </ogc:PropertyIsEqualTo>
>       <ogc:PropertyIsLike wildCard="*" escape="\" singleChar="?">
>         <ogc:PropertyName>apiso:ServiceType</ogc:PropertyName>
>         <ogc:Literal>*opendap*</ogc:Literal>
>       </ogc:PropertyIsLike>
>     </ogc:And>
>   </ogc:Filter>
> </csw:Constraint>
> </csw:Query>
> </csw:GetRecords>
> '''
> Is there a way to do this same query using the OWSlib methods?
> 
> I know how to do things like:
> 
> bbox=[-71.5, 39.5, -63.0, 46]
> csw.getrecords(keywords=['sea_water_temperature'],bbox=bbox,maxrecords=10)
> csw.results
> 
> But I don't know how to do the above query that is supposed to find
> records with OPeNDAP responses.
> 
> Here is an Ipython Notebook that shows my testing of the CSW response
> with OWSlib:
> http://nbviewer.ipython.org/5462676
> 
> Thanks,
> Rich
> -
> Dr. Richard P. Signell   (508) 457-2229
> USGS, 384 Woods Hole Rd.
> Woods Hole, MA 02543-1598
> _______________________________________________
> OWSLib-users mailing list
> OWSLib-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/owslib-users
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/owslib-users/attachments/20130425/31f6802a/attachment.html>


More information about the OWSLib-users mailing list