Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

micka.soap: patch_after_wfst #353

Merged
merged 10 commits into from
May 5, 2021
Prev Previous commit
Next Next commit
map.micka.csw uses get_publication_info instead of inputfile if possible
  • Loading branch information
jirik committed May 5, 2021
commit e29ec700bec3b8cf5e1893a96fb1ae214b67d4e5
21 changes: 15 additions & 6 deletions src/layman/map/micka/csw.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from flask import current_app

from layman import settings, LaymanError
from layman.common import language as common_language, empty_method, empty_method_returns_none
from layman.common import language as common_language, empty_method, empty_method_returns_none, bbox as bbox_util
from layman.common.filesystem.uuid import get_publication_uuid_file
from layman.common.micka import util as common_util
from layman.map import MAP_TYPE
Expand Down Expand Up @@ -182,23 +182,32 @@ def get_template_path_and_values(username, mapname, http_method=None, actor_name
revision_date = datetime.now()
map_json = get_map_json(username, mapname)
operates_on = map_json_to_operates_on(map_json, editor=actor_name)
publ_info = get_publication_info(username, MAP_TYPE, mapname, context={
'keys': ['title', 'bounding_box', 'description'],
})
bbox_3857 = publ_info.get('bounding_box')
if bbox_util.is_empty(bbox_3857):
bbox_3857 = settings.LAYMAN_DEFAULT_OUTPUT_BBOX
extent = bbox_util.transform(tuple(bbox_3857), epsg_from=3857, epsg_to=4326)
title = publ_info['title']
abstract = publ_info.get('description')
md_language = next(iter(common_language.get_languages_iso639_2(' '.join([
map_json['title'] or '',
map_json['abstract'] or ''
title or '',
abstract or '',
]))), None)

prop_values = _get_property_values(
username=username,
mapname=mapname,
uuid=get_map_uuid(username, mapname),
title=map_json['title'],
abstract=map_json['abstract'] or None,
title=title,
abstract=abstract or None,
publication_date=publ_datetime.strftime('%Y-%m-%d'),
revision_date=revision_date.strftime('%Y-%m-%d'),
md_date_stamp=date.today().strftime('%Y-%m-%d'),
identifier=url_for('rest_workspace_map.get', workspace=username, mapname=mapname),
identifier_label=mapname,
extent=[float(c) for c in map_json['extent']],
extent=extent,
epsg_codes=map_json_to_epsg_codes(map_json),
md_organisation_name=None,
organisation_name=None,
Expand Down
2 changes: 1 addition & 1 deletion src/layman/map/rest_test_filled_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<gco:Decimal>-48.5</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>81.5</gco:Decimal>
<gco:Decimal>81.4999999999999</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
Expand Down