aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-04-19 15:32:53 +0200
committerTeddy Wing2017-04-19 15:32:53 +0200
commit8cd70f7da71a5824915a8848214afbd258c71cbe (patch)
tree481ef9140b01d4ff9a1877caf26dc930f99cd5c6
parentd0c6616943919a78d62f99237811cdfefffd35ec (diff)
downloadgeo-feature-examiner-8cd70f7da71a5824915a8848214afbd258c71cbe.tar.bz2
index.html: Reproduce OpenLayers WKT example
Copy some example code from: http://openlayers.org/en/latest/examples/wkt.html to work off of.
-rw-r--r--index.html33
1 files changed, 33 insertions, 0 deletions
diff --git a/index.html b/index.html
index fa7805a..cb76a11 100644
--- a/index.html
+++ b/index.html
@@ -7,6 +7,39 @@
<link rel="stylesheet" href="https://openlayers.org/en/v4.1.0/css/ol.css" type="text/css">
</head>
<body>
+ <div id="map"></div>
+
<script src="https://openlayers.org/en/v4.1.0/build/ol.js"></script>
+ <script>
+ var raster = new ol.layer.Tile({
+ source: new ol.source.OSM()
+ });
+
+ var wkt = 'POLYGON((10.689 -25.092, 34.595 ' +
+ '-20.170, 38.814 -35.639, 13.502 ' +
+ '-39.155, 10.689 -25.092))';
+
+ var format = new ol.format.WKT();
+
+ var feature = format.readFeature(wkt, {
+ dataProjection: 'EPSG:4326',
+ featureProjection: 'EPSG:3857'
+ });
+
+ var vector = new ol.layer.Vector({
+ source: new ol.source.Vector({
+ features: [feature]
+ })
+ });
+
+ var map = new ol.Map({
+ layers: [raster, vector],
+ target: 'map',
+ view: new ol.View({
+ center: [2952104.0199, -3277504.823],
+ zoom: 4
+ })
+ });
+ </script>
</body>
</html>