diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2016-09-13 00:06:19 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2016-09-13 00:06:19 +0200 |
commit | 928871aab3026a80a2e2fe3592bc9992f84a9144 (patch) | |
tree | 77e22b2899825a47dcc5e75b73420014d2bc4b57 | |
parent | c74db2396500d94b6df6517099d28c1afe2713f7 (diff) | |
download | kostely-928871aab3026a80a2e2fe3592bc9992f84a9144.tar.gz |
Upgrades
-rw-r--r-- | index.html | 5 | ||||
-rw-r--r-- | kostely.js | 49 | ||||
-rw-r--r-- | kostely.ods | bin | 0 -> 22403 bytes | |||
-rw-r--r-- | kostely.tsv | 22 |
4 files changed, 67 insertions, 9 deletions
@@ -20,6 +20,11 @@ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" type="text/javascript"> </script> + <style> + .ol_legend { + bottom: 0px; left: 0px; position: absolute; background-color: #FFFFFF; + } + </style> </head> <body> <div id="map"> @@ -75,13 +75,56 @@ httpRequest.onreadystatechange = function(data) { httpRequest.open('GET', 'kostely.tsv'); httpRequest.send(); +ol.control.WMSLegend = function(opt_options) { + var options = opt_options || {}; + this.options = options; + this.div = document.createElement('div'); + var legendP = document.createElement('p'); + legendP.innerHTML = 'Legend:'; + this.div.className = this.options.class + ' ol-unselectable'; + this.div.appendChild(legendP); + ol.control.Control.call(this, { + element: this.div + }); +}; +ol.inherits(ol.control.WMSLegend, ol.control.Control); + +ol.control.WMSLegend.prototype.drawLegendItem = function(layer) { + if (layer.get('showLegend') === true) { + try { + var url = layer.getSource().getUrls()[0]; + } + catch(err) { + var url = layer.getSource().getUrl(); + } + var legendImg = document.createElement('img'); + legendImg.src = url + '&version=' + this.options.wmsVersion + '&service=WMS&request=GetLegendGraphic&sld_version=1.1.0&layer=' + layer.getSource().getParams().layers + '&format=' + this.options.format; + this.div.appendChild(legendImg); + } +} + +ol.control.WMSLegend.prototype.setMap = function(map){ + ol.control.Control.prototype.setMap.call(this, map); + this.options.wmsVersion = this.options.wmsVersion || '1.3.0'; + this.options.format = this.options.format || 'image/png'; + var layers = map.getLayers().getArray(); + for (var i=0; i<layers.length; i++) { + if (layers[i] instanceof ol.layer.Group) { + var layersFromGroup = layers[i].getLayers().getArray(); + for (var j=0;j<layersFromGroup.length;j++) { + this.drawLegendItem(layersFromGroup[j]); + } + } else { + this.drawLegendItem(layers[i]); + } + } +}; + map.controls = ol.control.defaults({ attribution: false }); map.controls.extend([ new ol.control.Attribution({ collapsible: true - }) -]); -map.controls.extend([ + }), new ol.control.MousePosition() ]); diff --git a/kostely.ods b/kostely.ods Binary files differnew file mode 100644 index 0000000..b2b42fa --- /dev/null +++ b/kostely.ods diff --git a/kostely.tsv b/kostely.tsv index 8306f74..c2896c6 100644 --- a/kostely.tsv +++ b/kostely.tsv @@ -62,29 +62,35 @@ "49.615073" "14.698643" "Neustupov" "Kostel Nanebevzetí Panny Marie" "other" "6.6" "0,-12" "49.551325" "14.374297" "Obděnice" "Kostel Nanebevzetí Panny Marie" "other" "6.6" "0,-12" "49.67" "14.633056" "Olbramovice" "Kostel Všech svatých " "other" "6.6" "0,-12" +"49.593889" "17.254167" "Olomouc" "Kostel sv. Michaela archanděla" "question" "6.6" "0,-12" +"49.595094" "17.251364" "Olomouc" "Kostel sv. Mořice" "question" "6.6" "0,-12" "49.168286" "16.450199" "Omice" "Kostel sv. Jakuba Staršího" "other" "6.6" "0,-12" "49.126698" "16.334834" "Oslavany" "Kostel Matky Boží" "other" "6.6" "0,-12" "49.692956" "14.685055" "Ouběnice" "Kostel sv. Markéty" "other" "6.6" "0,-12" "49.834444" "15.566944" "Pařížov" "Kostel sv. Maří Magdaleny" "other" "6.6" "0,-12" +"49.75470" "15.18203" "Pertoltice" "Kostel sv. Jiří" "other" "6.6" "0,-12" "49.934444" "13.390833" "Plasy" "Kostel Nanebevzetí Panny Marie" "other" "6.6" "0,-12" "50.0504689" "15.0324231" "Plaňany" "Kostel Zvěstování Panny Marie" "other" "6.6" "0,-12" "48.928889" "16.077222" "Plaveč" "Rotunda Nanebevzetí Panny Marie" "rotunda" "6.6" "0,-12" "49.83641" "14.6751283" "Poříčí nad Sázavou" "Kostel sv. Petra a Pavla" "other" "6.6" "0,-12" "49.8403263" "14.6803391" "Poříčí nad Sázavou" "Kostel sv. Havla" "other" "6.6" "0,-12" "50.016944" "13.401667" "Potvorov" "Kostel sv. Mikuláše" "other" "6.6" "0,-12" -"50.149444" "14.443333" "Praha - Dolní Chabry" "Kostel Stětí sv. Jana Křtitele" "other" "6.6" "0,-12" -"50.09125" "14.4025" "Praha - Hrad" "Bazilika sv. Jiří" "other" "6.6" "0,-12" -"50.097778" "14.548056" "Praha - Kyje" "Kostel sv. Bartoloměje" "other" "6.6" "0,-12" -"50.081944" "14.406389" "Praha - Malá Strana" "Kostel sv. Jana Křtitele Na prádle" "other" "6.6" "0,-12" -"50.091261" "14.434444" "Praha - Nové město" "Kostel sv. Petra na Poříčí" "other" "6.6" "0,-12" +"50.04778" "14.36722" "Praha – Butovice" "Kostel sv. Vavřince" "other" "6.6" "0,-12" +"50.149444" "14.443333" "Praha – Dolní Chabry" "Kostel Stětí sv. Jana Křtitele" "other" "6.6" "0,-12" +"50.09125" "14.4025" "Praha – Hrad" "Bazilika sv. Jiří" "other" "6.6" "0,-12" +"50.097778" "14.548056" "Praha – Kyje" "Kostel sv. Bartoloměje" "other" "6.6" "0,-12" +"50.081944" "14.406389" "Praha – Malá Strana" "Kostel sv. Jana Křtitele Na prádle" "other" "6.6" "0,-12" +"50.091261" "14.434444" "Praha – Nové město" "Kostel sv. Petra na Poříčí" "other" "6.6" "0,-12" "50.084806" "14.356861" "Praha – Břevnov" "Kostel sv. Markéty" "other" "6.6" "0,-12" "50.0490556" "14.5244694" "Praha – Hostivař" "Kostel Stětí sv. Jana Křtitele" "other" "6.6" "0,-12" +"50.072409" "14.416849" "Praha – Nové město" "Kostel sv. Kosmy a Damiána v Emauzích" "other" "6.6" "0,-12" +"50.075278" "14.415833" "Praha – Nové město" "Kostel sv. Václava na Zderaze" "other" "6.6" "0,-12" "50.076406" "14.42486" "Praha – Nové město" "Rotunda sv. Longina" "rotunda" "6.6" "0,-12" +"50.059908" "14.420794" "Praha – Podolí" "Kostel sv. Michaela archanděla" "other" "6.6" "0,-12" "50.117222" "14.296389" "Praha – Přední Kopanina" "Kostel sv. Máří Magdaleny" "rotunda" "6.6" "0,-12" "50.1181361" "14.4947472" "Praha – Prosek" "Kostel sv. Václava" "other" "6.6" "0,-12" "50.071389" "14.300278" "Praha – Řepy" "Kostel sv. Martina" "other" "6.6" "0,-12" "50.082778" "14.414722" "Praha – Staré město" "Rotunda sv. Kříže Menšího" "rotunda" "6.6" "0,-12" -"50.0864" "14.3892" "Praha – Strahov" "Bazilika Nanebevzetí Panny Marie" "other" "6.6" "0,-12" "50.0636" "14.4213" "Praha – Vyšehrad" "Rotunda sv. Martina" "rotunda" "6.6" "0,-12" "49.6325" "14.926667" "Pravonín" "Rotunda sv. Jana Křtitele" "rotunda" "6.6" "0,-12" "49.353231" "16.400679" "Předklášteří" "Kostel Nanebevzetí Panny Marie" "other" "6.6" "0,-12" @@ -108,6 +114,9 @@ "49.1875" "15.903333" "Střítež, okres Třebíč" "Kostel sv. Marka" "other" "6.6" "0,-12" "49.766166" "12.910722" "Svojšín" "Kostel sv. Petra a Pavla" "other" "6.6" "0,-12" "49.18301" "15.454682" "Telč" "Kostel sv. Ducha" "other" "6.6" "0,-12" +"49.966466" "12.878437" "Teplá" "Kostel Zvěstování Páně" "other" "6.6" "0,-12" +"49.9500596" "14.103972" "Tetín" "Kostel sv. Jana Nepomuckého" "other" "6.6" "0,-12" +"49.9490251" "14.102791" "Tetín" "Kostel sv. Kateřiny Alexandrijské" "other" "6.6" "0,-12" "50.055833" "14.821861" "Tismice" "Kostel Nanebevzetí Panny Marie" "other" "6.6" "0,-12" "49.699722" "14.6425" "Tožice" "Kostel sv. Martina" "other" "6.6" "0,-12" "49.773889" "14.831389" "Třebešice" "Kostel Všech svatých" "other" "6.6" "0,-12" @@ -117,6 +126,7 @@ "50.445556" "13.462222" "Údlice" "Kostel Povýšení sv. Kříže" "other" "6.6" "0,-12" "49.368889" "16.542222" "Újezd u Černé hory" "Kostel Všech svatých" "other" "6.6" "0,-12" "49.498333" "13.835278" "Újezdec" "Kostel sv. Voršily" "other" "6.6" "0,-12" +"49.103483" "17.395878" "Velehrad" "Bazilika Nanebevzetí Panny Marie a svatého Cyrila a Metoděje" "other" "6.6" "0,-12" "50.403889" "14.8575" "Vinec" "Kostel sv. Mikuláše" "other" "6.6" "0,-12" "49.249167" "13.739722" "Volenice" "Kostel sv. Petra a Pavla" "other" "6.6" "0,-12" "49.8530387" "14.7769065" "Vranov" "Kostel sv. Václava" "other" "6.6" "0,-12" |