Skip to content

Instantly share code, notes, and snippets.

@pgiraud
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save pgiraud/dc1ff40c0821b3f73120 to your computer and use it in GitHub Desktop.

Select an option

Save pgiraud/dc1ff40c0821b3f73120 to your computer and use it in GitHub Desktop.
OpenLayers 3 - Dash weird display
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="//openlayers.org/en/master/css/ol.css" type="text/css">
<link rel="stylesheet" href="//openlayers.org/en/master/resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="//openlayers.org/en/master/resources/layout.css" type="text/css">
<link rel="stylesheet" href="//openlayers.org/en/master/resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Measure example</title>
<style>
.tooltip {
background: rgba(0, 0, 0, 0.5);
border-radius: 4px;
color: white;
padding: 4px 8px;
position: absolute;
opacity: 1;
white-space: nowrap;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
</div>
<script src="//openlayers.org/en/master/resources/jquery.min.js" type="text/javascript"></script>
<script src="//openlayers.org/en/master/resources/example-behaviour.js" type="text/javascript"></script>
<script src="//openlayers.org/en/master/build/ol.js" type="text/javascript"></script>
<script src="index.js" type="text/javascript"></script>
</body>
</html>
var raster = new ol.layer.Tile({
source: new ol.source.OSM()
});
var source = new ol.source.Vector();
var vector = new ol.layer.Vector({
source: source,
style: new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.2)'
}),
stroke: new ol.style.Stroke({
color: '#ffcc33',
width: 2
}),
image: new ol.style.Circle({
radius: 7,
fill: new ol.style.Fill({
color: '#ffcc33'
})
})
})
});
var map = new ol.Map({
layers: [raster, vector],
renderer: exampleNS.getRendererFromQueryString(),
target: 'map',
view: new ol.View({
center: [-11000000, 4600000],
zoom: 4
})
});
var draw = new ol.interaction.Draw({
source: source,
type: 'Polygon',
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(255, 0, 0, 0.5)',
lineDash: [10, 10],
width: 2
})
})
});
map.addInteraction(draw);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment