Skip to content

Instantly share code, notes, and snippets.

Created October 25, 2014 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/b8165d4179c4fc54dd8e to your computer and use it in GitHub Desktop.
Save anonymous/b8165d4179c4fc54dd8e to your computer and use it in GitHub Desktop.
<!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