-
-
Save ThomasG77/16bfcdab4671c7e8a300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<link rel="stylesheet" href="http://openlayers.org/en/v3.0.0/css/ol.css" type="text/css"> | |
<style> | |
body { | |
margin: 0; | |
padding: 0; | |
} | |
.map { | |
height: 400px; | |
width: 100%; | |
} | |
</style> | |
<script src="http://openlayers.org/en/v3.0.0/build/ol.js" type="text/javascript"></script> | |
<title>OpenLayers 3 - debug error</title> | |
</head> | |
<body> | |
<div id="map" class="map"></div> | |
<script type="text/javascript"> | |
var projection_lan = 'EPSG:4326'; | |
var projection_lat = 'EPSG:3857'; | |
var map; | |
var pos = ol.proj.transform([ 12.102727890014648, 49.017269896565764 ],projection_lan, projection_lat); | |
function init() { | |
var localTiles = new ol.layer.Tile({ | |
source : new ol.source.XYZ({ | |
url : this.tiles_url | |
}) | |
}); | |
this.map = new ol.Map({ | |
layers : [ new ol.layer.Tile({ | |
source : new ol.source.MapQuest({ | |
layer : 'sat' | |
}) | |
}) ], | |
target : 'map', | |
view : new ol.View({ | |
center : pos, | |
zoom : 10 | |
}) | |
}); | |
var iconFeature = new ol.Feature( | |
{geometry : new ol.geom.Point(pos) | |
}); | |
var iconStyle = new ol.style.Style({ | |
image : new ol.style.Icon({ | |
src : 'http://ol3js.org/en/master/examples/data/icon.png' | |
}) | |
}); | |
iconFeature.setStyle(iconStyle); | |
var vectorSource = new ol.source.Vector({ | |
features : [ iconFeature ] | |
}); | |
var vectorLayer = new ol.layer.Vector({ | |
source : vectorSource | |
}); | |
this.map.addLayer(vectorLayer); | |
} | |
init(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment