capture dct:spatial as bbox, if it contains a box#963
capture dct:spatial as bbox, if it contains a box#963tomkralidis merged 2 commits intogeopython:masterfrom
Conversation
|
@pvgenuchten - great to get some tests for the CSW parsing. It looks like there is a lot of shared code in the A couple of questions:
|
|
@pvgenuchten - we're looking to make a new release of OWSLib. If you have any thoughts on the above questions, please add to this ticket. Are you then happy to merge? |
I'm not sure i'm able to manage the refactore, but for sure is a good idea. I'd say postpone to next PR.
valid question, I will have a look, maybe we can store both?
dct:spatial indeed is often populated with a spatial label, such as |
|
This Pull Request has been inactive for 90 days. In order to manage maintenance burden, it will be automatically closed in 7 days. |
|
This Pull Request has been inactive for 90 days. In order to manage maintenance burden, it will be automatically closed in 7 days. |
|
This Pull Request has been closed due to there being no activity for more than 90 days. |
tests/test_csw_parsing.py
Outdated
| md_resource = get_md_resource('tests/resources/9250AA67-F3AC-6C12-0CB9-0662231AA181_dc2.xml') | ||
| md = CswRecord(md_resource) | ||
|
|
||
| assert type(md) is CswRecord |
There was a problem hiding this comment.
assert isinstance(CswRecord, md)
tests/test_csw_parsing.py
Outdated
| """ | ||
| namespaces = Namespaces().get_namespaces(keys=('dc', 'dct', 'ows', 'rdf', 'gml', 'csw')) | ||
|
|
||
| with io.open(file_path, mode='r', encoding='utf-8') as f: |
There was a problem hiding this comment.
Can we use open() instead of io.open?
| else: | ||
| self.bbox = None | ||
|
|
||
| val = record.find(util.nspath_eval('dct:spatial', namespaces)) |
There was a problem hiding this comment.
Suggest the below (also for owslib/catalogue/csw3.py):
val = record.find(util.nspath_eval('dct:spatial', namespaces))
self.spatial = None
if val is not None:
val = util.testXMLValue(val)
tokens = val.split(',')
if len(tokens) == 4:
self.bbox = ows.BoundingBox(None, namespaces['ows'])
self.bbox.minx = tokens[0]
self.bbox.miny = tokens[1]
self.bbox.maxx = tokens[2]
self.bbox.maxy = tokens[3]
else:
self.spatial = valThere was a problem hiding this comment.
it seems already there
|
This Pull Request has been inactive for 90 days. In order to manage maintenance burden, it will be automatically closed in 7 days. |
33abe59 to
2e0b676
Compare
|
wfs test failures not related |
| else: | ||
| self.bbox = None | ||
|
|
||
| val = record.find(util.nspath_eval('dct:spatial', namespaces)) |
There was a problem hiding this comment.
val = record.find(util.nspath_eval('dct:spatial', namespaces)) 1Code has comments. Press enter to view.
self.spatial = None
if val is not None:
val = util.testXMLValue(val)
bbox_tokens = val.split(',')
if len(bbox_token) == 4:
self.bbox = ows.BoundingBox(None, namespaces['ows'])
self.bbox.minx = bbox_tokens[0]
self.bbox.miny = bbox_tokens[1]
self.bbox.maxx = bbox_tokens[2]
self.bbox.maxy = bbox_tokens[3]
else:
self.spatial = val|
|
||
| val = record.find(util.nspath_eval('dct:spatial', namespaces)) | ||
| self.spatial = None | ||
| if val is not None: |
There was a problem hiding this comment.
if val is not None:
val = util.testXMLValue(val)
bbox_tokens = val.split(',')
if len(bbox_token) == 4:
self.bbox = ows.BoundingBox(None, namespaces['ows'])
self.bbox.minx = bbox_tokens[0]
self.bbox.miny = bbox_tokens[1]
self.bbox.maxx = bbox_tokens[2]
self.bbox.maxy = bbox_tokens[3]
else:
self.spatial = val2e0b676 to
6943ee4
Compare
6943ee4 to
04258b0
Compare
in some cases, bbox is strored in dct:spatial, nice to have it as bbox
added some csw parse tests, seemed not existing