force all CSW GetRecords requests to set ogc:SortBy to ensure proper ordering
This commit is contained in:
parent
7b467ebdd7
commit
eb9cd6fc1c
|
@ -6,7 +6,7 @@ for convenience.
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from owslib.etree import etree
|
from owslib.etree import etree
|
||||||
from owslib.fes import PropertyIsEqualTo
|
from owslib.fes import PropertyIsEqualTo, SortBy, SortProperty
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -66,6 +66,10 @@ class CswService(OwsService):
|
||||||
Perform various operations on a CSW service
|
Perform various operations on a CSW service
|
||||||
"""
|
"""
|
||||||
from owslib.csw import CatalogueServiceWeb as _Implementation
|
from owslib.csw import CatalogueServiceWeb as _Implementation
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.sortby = SortBy([SortProperty('dc:identifier')])
|
||||||
|
|
||||||
def getrecords(self, qtype=None, keywords=[],
|
def getrecords(self, qtype=None, keywords=[],
|
||||||
typenames="csw:Record", esn="brief",
|
typenames="csw:Record", esn="brief",
|
||||||
skip=0, count=10, outputschema="gmd", **kw):
|
skip=0, count=10, outputschema="gmd", **kw):
|
||||||
|
@ -83,6 +87,7 @@ class CswService(OwsService):
|
||||||
"startposition": skip,
|
"startposition": skip,
|
||||||
"maxrecords": count,
|
"maxrecords": count,
|
||||||
"outputschema": namespaces[outputschema],
|
"outputschema": namespaces[outputschema],
|
||||||
|
"sortby": self.sortby
|
||||||
}
|
}
|
||||||
log.info('Making CSW request: getrecords2 %r', kwa)
|
log.info('Making CSW request: getrecords2 %r', kwa)
|
||||||
csw.getrecords2(**kwa)
|
csw.getrecords2(**kwa)
|
||||||
|
@ -110,7 +115,8 @@ class CswService(OwsService):
|
||||||
"startposition": startposition,
|
"startposition": startposition,
|
||||||
"maxrecords": page,
|
"maxrecords": page,
|
||||||
"outputschema": namespaces[outputschema],
|
"outputschema": namespaces[outputschema],
|
||||||
"cql":cql,
|
"cql": cql,
|
||||||
|
"sortby": self.sortby
|
||||||
}
|
}
|
||||||
i = 0
|
i = 0
|
||||||
matches = 0
|
matches = 0
|
||||||
|
|
Loading…
Reference in New Issue