aboutsummaryrefslogtreecommitdiffstats
path: root/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'index.html')
-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>