{"id":10097,"date":"2020-12-16T19:09:59","date_gmt":"2020-12-16T18:09:59","guid":{"rendered":"https:\/\/hb9sota.ch\/?page_id=10097"},"modified":"2025-01-06T17:55:39","modified_gmt":"2025-01-06T16:55:39","slug":"sommets-dans-les-regions-wwff","status":"publish","type":"page","link":"https:\/\/hb9sota.ch\/fr\/sommets-dans-les-regions-wwff\/","title":{"rendered":"Sommets dans les r\u00e9gions WWFF"},"content":{"rendered":"\n<script src=\"\/\/api3.geo.admin.ch\/loader.js?version=4.4.2\"><\/script>\n<script src=\"\/js\/jquery-3.6.0.min.js\"><\/script>\n<script src=\"\/js\/bootstrap.min.js\"><\/script>\n<link rel=\"stylesheet\" href=\"\/css\/popover.css\">\n<div id=\"hbff_header\"><\/div>\n<div id=\"map\" class=\"map\"><\/div>\n<style type=\"text\/css\">\n.map {\n  height: 500px;\n  margin-bottom: 1em;\n  margin-top: 1em;\n}\n.popover {\n  min-width: 300px;\n  overflow-wrap: break-word;\n}\n<\/style>\n<script type=\"text\/javascript\">\n\/\/ Create a GeoAdmin Map\nvar map = new ga.Map({\n  \n  \/\/ Define the div where the map is placed\n  target: 'map',\n  \n  \/\/ Create a view\n  view: new ol.View({\n    \n    \/\/ Define the default resolution\n    \/\/ 10 means that one pixel is 10m width and height\n    \/\/ List of resolution of the WMTS layers:\n    \/\/ 650, 500, 250, 100, 50, 20, 10, 5, 2.5, 2, 1, 0.5, 0.25, 0.1\n    resolution: 500,\n    \n    \/\/ Define a coordinate CH1903+ (EPSG:2056) for the center of the view\n    center: [2660000, 1190000]\n  })\n});\n\n\/\/ Create a background layer\nvar lyr1 = ga.layer.create('ch.swisstopo.pixelkarte-farbe');\nlyr1.setOpacity(0.7);\n\n\/\/ Add the background layer in the map\nmap.addLayer(lyr1);\n\n\/\/ Create the KML Layer\nvar vector = new ol.layer.Vector({\n  source: new ol.source.Vector({\n    url: 'https:\/\/hb9sota.ch\/hbff-data\/hbff.kml',\n    format : new ol.format.KML({\n      projection: 'EPSG:21781'\n    })\n  })\n});\n\nmap.addLayer(vector);\n\n\/\/ Popup showing the position the user clicked\nvar popup = new ol.Overlay({\n  element: $('<div><\/div>')[0]\n});\nmap.addOverlay(popup);\n\n\/\/ On click we display the feature informations\nmap.on('singleclick', function(evt) {\n  var pixel = evt.pixel;\n  var coordinate = evt.coordinate;\n  var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) {\n    return feature;\n  });\n  var element = $(popup.getElement());\n  element.popover('destroy');\n  if (feature) {\n     popup.setPosition(coordinate);\n     element.popover({\n      'placement': 'top',\n      'animation': false,\n      'html': true,\n      'content': feature.get('description')\n     });\n     element.popover('show');\n  }\n});\n\n\/\/ Change cursor style when cursor is hover a feature\nmap.on('pointermove', function(evt) {\n  var feature = map.forEachFeatureAtPixel(evt.pixel, function(feature, layer) {\n    return feature;\n  });\n  map.getTargetElement().style.cursor = feature ? 'pointer' : '';\n});\n\n$(function() {\n  loadHeader();\n  loadLinks();\n});\n\n\nfunction zoomTo(coords) {\n  map.getView().setCenter([coords[0] + 2000000, coords[1] + 1000000]);\n  map.getView().setResolution(2);\n}\n\nfunction loadHeader() {\n  $('#hbff_header').load(\"https:\/\/hb9sota.ch\/hbff-data\/hbff.html\");\n}\n\nfunction loadLinks() {\n  $.getJSON(\"https:\/\/hb9sota.ch\/hbff-data\/hbff.json\", {}, function(data) {\n    var links = '';\n    $.each(data, function(index, val) {\n      if (val.footer) {\n        links += '<p>' + escapeHTML(val.footer) + '<\/p>';\n      } else {\n        var linkText = escapeHTML(val.summitRef) + ' ' + escapeHTML(val.summitName) + ' -> ' + escapeHTML(val.parkRef) + ' ' + escapeHTML(val.parkName);\n        links += '<p><a href=\"#top\" onclick=\"zoomTo([' + escapeHTML(val.coordinates.join(',')) + '])\">' + escapeHTML(linkText) + '<\/a>'\n        if (val.remark) {\n          links += ' ' + escapeHTML(val.remark);\n        }\n        links += '<\/p>';\n      }\n    });\n    $('#links').html(links);\n  });\n}\n\nfunction escapeHTML(html) {\n    return html.replace(\/&\/g,'&amp;').replace(\/<\/g,'&lt;').replace(\/>\/g,'&gt;');\n}\n\n<\/script>\n\n\n\n<div id=\"links\"><\/div>\n\n<p><a href=\"\/hbff-data\/hbff.kml\">Download KML<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Download KML<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"publish_to_discourse":"","publish_post_category":"","wpdc_auto_publish_overridden":"","wpdc_topic_tags":"","wpdc_pin_topic":"","wpdc_pin_until":"","discourse_post_id":"","discourse_permalink":"","wpdc_publishing_response":"","wpdc_publishing_error":"","footnotes":""},"class_list":["post-10097","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/hb9sota.ch\/fr\/wp-json\/wp\/v2\/pages\/10097","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hb9sota.ch\/fr\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/hb9sota.ch\/fr\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/hb9sota.ch\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hb9sota.ch\/fr\/wp-json\/wp\/v2\/comments?post=10097"}],"version-history":[{"count":1,"href":"https:\/\/hb9sota.ch\/fr\/wp-json\/wp\/v2\/pages\/10097\/revisions"}],"predecessor-version":[{"id":10098,"href":"https:\/\/hb9sota.ch\/fr\/wp-json\/wp\/v2\/pages\/10097\/revisions\/10098"}],"wp:attachment":[{"href":"https:\/\/hb9sota.ch\/fr\/wp-json\/wp\/v2\/media?parent=10097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}