piersoft

Untitled

Jan 26th, 2014
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. ?>
  4. <!DOCTYPE html>
  5. <html lang="it">
  6. <head>
  7. <title>List of World Heritage Sites</title>
  8. <meta property="og:image" content="http://www.piersoft.it/wp-content/uploads/2014/01/screen_unesco-300x152.png" />
  9. <link rel="stylesheet" href="http://necolas.github.io/normalize.css/2.1.3/normalize.css" />
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  11. <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
  12. <link rel="stylesheet" href="MarkerCluster.css" />
  13. <link rel="stylesheet" href="MarkerCluster.Default.css" />
  14. <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
  15. <script src="leaflet.markercluster.js"></script>
  16. <script type="text/javascript">
  17. function microAjax(B,A){this.bindFunction=function(E,D){return function(){return E.apply(D,[D])}};this.stateChange=function(D){if(this.request.readyState==4){this.callbackFunction(this.request.responseText)}};this.getRequest=function(){if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP")}else{if(window.XMLHttpRequest){return new XMLHttpRequest()}}return false};this.postBody=(arguments[2]||"");this.callbackFunction=A;this.url=B;this.request=this.getRequest();if(this.request){var C=this.request;C.onreadystatechange=this.bindFunction(this.stateChange,this);if(this.postBody!==""){C.open("POST",B,true);C.setRequestHeader("X-Requested-With","XMLHttpRequest"); C.setRequestHeader("Content-type","application/x-www-form-urlencoded");C.setRequestHeader("Connection","close")}else{C.open("GET",B,true)}C.send(this.postBody)}};
  18. </script>
  19. <style>
  20. #mapdiv{
  21. position:fixed;
  22. top:0;
  23. right:0;
  24. left:0;
  25. bottom:0;
  26. }
  27. #loading {
  28. position:fixed;
  29. top:0;
  30. left:0;
  31. width:100%;
  32. height:100%;
  33. background-color:#666;
  34. color:#fff;
  35. font-size:1em;
  36. padding:10% 40px;
  37. z-index:10;
  38. text-align:center;
  39. }
  40. #infodiv{
  41. background-color: rgba(255, 255, 255, 0.95);
  42.  
  43. border-width: 2px;
  44. border-style: solid;
  45. border-color: rgba(255, 255, 255, 0.8);
  46.  
  47. border-radius: 9px;
  48.  
  49. padding: 10px;
  50.  
  51. //width: 90%;
  52. font-size: 11px;
  53. botton: 2px;
  54. left: 2px;
  55.  
  56. bottom: 20px;
  57. max-height: 50px;
  58.  
  59. position: fixed;
  60.  
  61. overflow-y: auto;
  62. overflow-x: hidden;
  63. }
  64. </style>
  65. </head>
  66.  
  67. <body>
  68.  
  69. <div id="mapdiv"></div>
  70. <script src='leaflet-edit-osm.js'></script>
  71. <script type="text/javascript">
  72. var lat=40.662617,
  73. lon=16.6191,
  74. zoom=2;
  75. var osm = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {maxZoom: 19, attribution: 'Map Data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors | @Piersoft from <a href="http://whc.unesco.org/en/list/">UNESCO</a> list (25.01.14) | <a href="http://en.wikipedia.org/wiki/Table_of_World_Heritage_Sites_by_country">ListTable</a> | <b>Cultural: </b><img src="logo_unesco_c.png" width="9" height="9"><b> Natural: </b><img src="logo_unesco_n.png" width="9" height="9"><b> Mixed: </b><img src="logo_unesco_m.png" width="9" height="9">'});
  76. var mapquest = new L.TileLayer('http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png', {subdomains: '1234', maxZoom: 18, attribution: 'Map Data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors | @Piersoft from <a href="http://whc.unesco.org/en/list/">UNESCO</a> list (25.01.14) | <a href="http://en.wikipedia.org/wiki/Table_of_World_Heritage_Sites_by_country">ListTable</a> | <b>Cultural: </b><img src="logo_unesco_c.png" width="9" height="9"><b> Natural: </b><img src="logo_unesco_n.png" width="9" height="9"><b> Mixed: </b><img src="logo_unesco_m.png" width="9" height="9">'});
  77.  
  78. var baseLayer = L.tileLayer('http://tile.cloudmade.com/82e1a1bab27244f0ab6a3dd1770f7d11/999/256/{z}/{x}/{y}.png', {maxZoom: 19, attribution: 'Map Data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors | @Piersoft from <a href="http://whc.unesco.org/en/list/">UNESCO</a> list (25.01.14) | <a href="http://en.wikipedia.org/wiki/Table_of_World_Heritage_Sites_by_country">ListTable</a> | <b>Cultural: </b><img src="logo_unesco_c.png" width="9" height="9"><b> Natural: </b><img src="logo_unesco_n.png" width="9" height="9"><b> Mixed: </b><img src="logo_unesco_m.png" width="9" height="9">'});
  79.  
  80.  
  81. var map = new L.Map('mapdiv', {
  82. editInOSMControl: true,
  83. editInOSMControlOptions: {
  84. position: "topright"
  85. },
  86. center: new L.LatLng(lat, lon),
  87. zoom: zoom,
  88. layers: [baseLayer]
  89. });
  90. new leafletEditOsm().addTo(map);
  91.  
  92. var baseMaps = {
  93. "Cloudmade": baseLayer,
  94. "Mapnik": osm,
  95. "Mapquest Open": mapquest
  96. };
  97. L.control.layers(baseMaps).addTo(map);
  98.  
  99.  
  100.  
  101.  
  102. microAjax('unesco.json',function (res) {
  103. var feat=JSON.parse(res);
  104. loadLayer(feat);
  105.  
  106. } );
  107. var ico=L.icon({iconUrl:'logo_unesco_c.png', iconSize:[20,20],iconAnchor:[10,0]});
  108. var markers = L.markerClusterGroup();
  109.  
  110.  
  111. function loadLayer(url)
  112. {
  113.  
  114. var myLayer = L.geoJson(url,{
  115. onEachFeature:function onEachFeature(feature, layer) {
  116.  
  117. if (feature.properties) {
  118.  
  119. var string='<div align="center"><img src="http://whc.unesco.org/uploads/sites/site_'+feature.properties.id_no+'.jpg"></div></br><b>';
  120. string +='Name:</b> '+feature.properties.name_en+'</br><b>Short description:</b> '+feature.properties.short_description_en+'<br/><b>Date inscribed:</b> '+feature.properties.date_inscribed+"<br/>";
  121. string +='<b>Category:</b> '+feature.properties.category+"<br/>"+'<b>State:</b> '+feature.properties.states_name_en;
  122. string +='</br></br><a href="http://map.f4-group.com/#lat='+feature.geometry.coordinates[1]+'&lon='+feature.geometry.coordinates[0]+'&zoom=16" target="_blank">Link 3D</a></br>';
  123. string +='<a href="http://www.openstreetmap.org/edit?zoom=15&editor=id&lat=' +feature.geometry.coordinates[1]+ '&lon='+feature.geometry.coordinates[0]+'" target="_blank">Edit in OSM</a>';
  124.  
  125. layer.bindPopup(string, {
  126. maxWidth: "200",
  127. maxHeight: "200",
  128. closeButton: false
  129. });
  130.  
  131. }
  132. },
  133.  
  134. pointToLayer: function (feature, latlng) {
  135. if (feature.properties.category_short == "N") {ico=L.icon({iconUrl:'logo_unesco_n.png', iconSize:[20,20],iconAnchor:[10,0]})}
  136. else if (feature.properties.category_short == "C") {ico=L.icon({iconUrl:'logo_unesco_c.png', iconSize:[20,20],iconAnchor:[10,0]})}else {
  137. {ico=L.icon({iconUrl:'logo_unesco_m.png', iconSize:[20,20],iconAnchor:[10,0]})}
  138. };
  139.  
  140.  
  141.  
  142. var marker = new L.marker(latlng, { icon: ico });
  143. markers[feature.properties.id] = marker;
  144. return marker;
  145.  
  146. }
  147. }).addTo(markers);
  148.  
  149. markers.addLayer(myLayer);
  150.  
  151. }
  152.  
  153.  
  154.  
  155. map.addLayer(markers);
  156. map.fitBounds(markers.getBounds());
  157. </script>
  158.  
  159. </body>
  160. </html>
Advertisement
Add Comment
Please, Sign In to add comment