Skip to content

Commit

Permalink
Merge pull request #1736 from openoereb/fix_layers_when_merging_themes
Browse files Browse the repository at this point in the history
Fix layers when merging themes
  • Loading branch information
marionb authored Jul 24, 2023
2 parents ced6a57 + b33d70e commit 70ebb15
Show file tree
Hide file tree
Showing 9 changed files with 5,603 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@
"published_until": "2100-01-01",
"id": 1297,
"law_status": "inKraft",
"geom": "SRID=2056;GEOMETRYCOLLECTION(POINT(2608838.16 1261846.96))",
"public_law_restriction_id": 401
}, {
"published_from": "2016-02-25",
"published_until": "2100-01-01",
"id": 1298,
"law_status": "inKraft",
"geom": "SRID=2056;GEOMETRYCOLLECTION(POINT(2608838.14 1261846.96))",
"public_law_restriction_id": 400
"public_law_restriction_id": 402
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@
"published_until": "2100-01-01",
"id": 401,
"law_status": "inKraft",
"view_service_id": 1,
"view_service_id": 3,
"legend_entry_id": 1
}, {
"office_id": 1,
"published_from": "2016-02-25",
"published_until": "2100-01-01",
"id": 402,
"law_status": "inKraft",
"view_service_id": 2,
"legend_entry_id": 1
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,21 @@
},
"layer_index": 1,
"layer_opacity": 0.75
},{
"id": 2,
"reference_wms": {
"de": "https://wms.map.geo.admin.ch/?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&STYLES=default&CRS=EPSG:2056&BBOX=2475000,1065000,2850000,1300000&WIDTH=740&HEIGHT=500&FORMAT=image/png&LAYERS=ch.bav.kataster-belasteter-standorte-oev.oereb.V2",
"fr": "https://wms.map.geo.admin.ch/?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&STYLES=default&CRS=EPSG:2056&BBOX=2475000,1065000,2850000,1300000&WIDTH=740&HEIGHT=500&FORMAT=image/png&LAYERS=ch.bav.kataster-belasteter-standorte-oev.oereb.V2"
},
"layer_index": 2,
"layer_opacity": 0.75
},{
"id": 3,
"reference_wms": {
"de": "https://wms.map.geo.admin.ch/?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&STYLES=default&CRS=EPSG:2056&BBOX=2475000,1065000,2850000,1300000&WIDTH=740&HEIGHT=500&FORMAT=image/png&LAYERS=ch.bav.kataster-belasteter-standorte-oev.oereb.V3",
"fr": "https://wms.map.geo.admin.ch/?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&STYLES=default&CRS=EPSG:2056&BBOX=2475000,1065000,2850000,1300000&WIDTH=740&HEIGHT=500&FORMAT=image/png&LAYERS=ch.bav.kataster-belasteter-standorte-oev.oereb.V3"
},
"layer_index": 3,
"layer_opacity": 0.75
}
]
2 changes: 1 addition & 1 deletion dev/sample_data/forest_perimeters/legend_entry.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"type_code": "StaoTyp2",
"id": 16,
"type_code_list": "https://models.geo.admin.ch/BAFU/KbS_Codetexte_V1_4.xml",
"view_service_id": 1,
"view_service_id": 2,
"symbol": "iVBORw0KGgoAAAANSUhEUgAAAEgAAAAkAgMAAABXtZT1AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEWpy/5Tlv4AZv////8CA41OAAAAAWJLR0QDEQxM8gAAAAd0SU1FB+MEHQwnDaaZ3bIAAAAcSURBVCjPYxANRQMhDFmr0MDKUaFRIXoLYSZMAIgsmUho/kyPAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE5LTA0LTI5VDE0OjM5OjEzKzAyOjAwWzeaVwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOS0wNC0yOVQxNDozOToxMyswMjowMCpqIusAAAAASUVORK5CYII=",
"theme": "ch.StatischeWaldgrenzen"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"published_until": "2100-01-01",
"id": 403,
"law_status": "inKraft",
"view_service_id": 1,
"view_service_id": 2,
"legend_entry_id": 16
}
]
9 changes: 9 additions & 0 deletions dev/sample_data/forest_perimeters/view_service.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,14 @@
},
"layer_index": 1,
"layer_opacity": 0.75
},
{
"id": 2,
"reference_wms": {
"de": "https://wms.geo.admin.ch/?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&STYLES=default&CRS=EPSG:2056&BBOX=2475000,1065000,2850000,1300000&WIDTH=740&HEIGHT=500&FORMAT=image/png&LAYERS=ch.bav.kataster-belasteter-standorte-oev.oereb.V2",
"fr": "https://wms.geo.admin.ch/?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&STYLES=default&CRS=EPSG:2056&BBOX=2475000,1065000,2850000,1300000&WIDTH=740&HEIGHT=500&FORMAT=image/png&LAYERS=ch.bav.kataster-belasteter-standorte-oev.oereb.V2"
},
"layer_index": 2,
"layer_opacity": 0.75
}
]
20 changes: 20 additions & 0 deletions pyramid_oereb/contrib/print_proxy/mapfish_print/mapfish_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,26 @@ def convert_to_printable_extract(self, extract_dict, feature_geometry):
if new_responsible_office['Name'] not in existing_office_names:
current['ResponsibleOffice'].append(new_responsible_office)

# add additionally map layer to the theme if not already there
new_layer = restriction_on_landownership['baseLayers']['layers'][0]['layers'][0]
new_base_url = restriction_on_landownership['baseLayers']['layers'][0]['baseURL']
existing_layer = [
layer for layers in current['baseLayers']['layers'] for layer in layers['layers']
]
if new_layer not in existing_layer:
# add it in the element with the same baseURL.
# The rest of the parameters should be the same as given by the theme
layer_added = False
for element in current['baseLayers']['layers']:
if new_base_url == element['baseURL']:
element['layers'].append(new_layer)
layer_added = True
break
if not layer_added:
current['baseLayers']['layers'].append(
restriction_on_landownership['baseLayers']['layers'][0]
)

# Text
for element in text_element:
if element in restriction_on_landownership:
Expand Down
Loading

0 comments on commit 70ebb15

Please sign in to comment.