diff options
author | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
commit | ea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch) | |
tree | af67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/examples/sld-parser.html | |
parent | 59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff) | |
download | postrunner-ea346a785dc1b3f7c156f6fc33da634e1f1a627b.zip |
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/examples/sld-parser.html')
-rw-r--r-- | misc/openlayers/examples/sld-parser.html | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/misc/openlayers/examples/sld-parser.html b/misc/openlayers/examples/sld-parser.html new file mode 100644 index 0000000..14f87ea --- /dev/null +++ b/misc/openlayers/examples/sld-parser.html @@ -0,0 +1,70 @@ +<!DOCTYPE html> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> + <meta name="apple-mobile-web-app-capable" content="yes"> + <title>OpenLayers SLD Parser</title> + <link rel="stylesheet" href="../theme/default/style.css" type="text/css"> + <link rel="stylesheet" href="style.css" type="text/css"> + <script src="../lib/OpenLayers.js"></script> + <style> + #input { + width: 90%; + height: 300px; + } + #output { + width: 90%; + height: 300px; + } + </style> + </head> + <body> + <h1 id="title">SLD Parser</h1> + <div id="tags"> + sld, sldselect, styling, style, parser, cleanup + </div> + <div id="shortdesc">Parsing Styled Layer Descriptor (SLD) documents with the SLD format.</div> + + <textarea id="input">paste SLD here</textarea><br> + <input type="checkbox" id="symbolizers" checked="checked"><label for="symbolizers">Maintain multiple symbolizers and FeatureTypeStyle elements</label><br> + <input type="checkbox" id="array"><label for="array">Compile an array of named styles instead of an object.</label><br> + <input type="button" id="button" value="Parse SLD"> + + <div id="docs"> + This example uses the SLD format to parse SLD documents pasted into the textarea above. + A rough representation of the parsed style is shown in the textarea below. + </div> + + <textarea id="output"></textarea> + + <script> + + var button = document.getElementById("button"); + var input = document.getElementById("input"); + var output = document.getElementById("output"); + var symbolizers = document.getElementById("symbolizers"); + var array = document.getElementById("array"); + + var json = new OpenLayers.Format.JSON(); + + var format, obj; + + button.onclick = function() { + var str = input.value; + format = new OpenLayers.Format.SLD({ + multipleSymbolizers: !!symbolizers.checked, + namedLayersAsArray: !!array.checked + }); + obj = format.read(str); + try { + output.value = json.write(obj, true); + } catch (err) { + output.value = "Trouble: " + err; + } + } + + </script> + + </body> +</html> |