[OWSLib-users] CSW query for datasets intersecting bounding box

Tom Kralidis tomkralidis at gmail.com
Mon Mar 3 14:54:56 PST 2014


FYI pycsw does the same thing (BBOX==Intersects):
https://github.com/geopython/pycsw/blob/master/pycsw/util.py#L156.  In
pycsw.util.query_spatial you can see how all FES spatial filters are
handled on the server side.


On Mon, Mar 3, 2014 at 5:49 PM, Kyle Wilcox <kyle at axiomalaska.com> wrote:
> Unfortunately, the entire FES suite is not included in the owslib.fes
> module.
>
> I've opened an issue for this:
> https://github.com/geopython/OWSLib/issues/128
>
> In the meantime, you can create the XML object yourself and pass it to the
> 'getrecords2' method.  It should look something like this:
>
> <...>
> <fes:Filter>
> <fes:Intersects>
> <fes:PropertyName>{{ your property }}</fes:PropertyName>
>     <gml:Envelope ... />
> </fes:Intersects>
> </fes:Filter>
> </...>
>
> On a side note, the GeoPortal documentation says ogc:BBOX and ogc:Intersects
> queries should both return "Overlaps" (I'm not sure if that helps):
> http://sourceforge.net/apps/mediawiki/geoportal/index.php?title=Catalog_Service#Spatial_Queries
>
> That document could also be out of date... it was last edited in 2010!
>
>
>
>
>
> On Mon, Mar 3, 2014 at 1:30 PM, Signell, Richard <rsignell at usgs.gov> wrote:
>>
>> On closer inspection, it appears that fes.BBox(bbox) is returning
>> datasets that are (1) completely within or (2) overlapping, but not
>> datasets where the bbox of interest is itself completely contained
>> within the dataset bounding box.
>>
>> So it's not finding my dataset that is the whole US East Coast when I
>> specify New York Harbor because the the bounding box for New York
>> Harbor is completely within the bounding box for the US East Coast.
>>
>> So I'm will wondering how to find my US East Coast model result with
>> my New York Harbor bbox, and more generally, how to specify these
>> different behaviors with OWSLib fes.
>>
>> On Mon, Mar 3, 2014 at 1:21 PM, Signell, Richard <rsignell at usgs.gov>
>> wrote:
>> > I want to use CSW to find all the datasets that overlap a specified
>> > bounding box (for example, if I specify my bounding box region of
>> > interest to be New York Harbor, I want to find datasets that span the
>> > whole east coast)
>> >
>> > The datasets are found correctly if I click "intersects" on the
>> > Geoportal Server GUI, which issues this geoportal rest command:
>> >
>> >
>> > http://geoport.whoi.edu/geoportal/rest/find/document?rid=local&ridName=Geoportal%20Instance&rids=local&searchText=ROMS%20OR%20ADCIRC%20OR%20POM&start=1&max=10&orderBy=relevance&spatialRel=esriSpatialRelOverlaps&bbox=-74.8738,40.2402,-73.468,41.0993&maxSearchTimeMilliSec=10000&f=searchpageresults&dojo.preventCache=1393870427656
>> >
>> > but how do I do this in CSW?
>> >
>> > I tried:
>> >
>> > from owslib.csw import CatalogueServiceWeb
>> > from owslib import fes
>> > endpoint = 'http://geoport.whoi.edu/geoportal/csw'
>> > csw = CatalogueServiceWeb(endpoint,timeout=60)
>> >
>> > bbox = [-74.8738,40.2402,-73.468,41.0993]
>> > filter = fes.BBox(box)
>> > csw.getrecords2(constraints=[filter],maxrecords=5,esn='full')
>> >
>> > but it only returned datasets completely *within* the specified bounding
>> > box.
>> >
>> > Thanks,
>> > -Rich
>> >


More information about the OWSLib-users mailing list