diff options
| author | Teddy Wing | 2017-04-19 15:32:53 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-04-19 15:32:53 +0200 | 
| commit | 8cd70f7da71a5824915a8848214afbd258c71cbe (patch) | |
| tree | 481ef9140b01d4ff9a1877caf26dc930f99cd5c6 /index.html | |
| parent | d0c6616943919a78d62f99237811cdfefffd35ec (diff) | |
| download | geo-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.
Diffstat (limited to 'index.html')
| -rw-r--r-- | index.html | 33 | 
1 files changed, 33 insertions, 0 deletions
| @@ -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> | 
