SVG element not visible when using a hex color?

6 views
Skip to first unread message

Rudiman

unread,
Jun 27, 2019, 8:44:02 AM6/27/19
to OpenLayers Dev
When i use a hexcolor in my svg the complete svg is not visible..
is that a bug in openlayers??


WORKING

var svg = '<svg width="120" height="120" version="1.1" xmlns="http://www.w3.org/2000/svg">'
+ '<rect x="0" y="0" width="40" height="50" stroke="red" stroke-width="3" "/>'
+ '</svg>';


NOT WORKING

var svg = '<svg width="120" height="120" version="1.1" xmlns="http://www.w3.org/2000/svg">'
+ '<rect x="0" y="0" width="40" height="50" stroke="#ff0000" stroke-width="3" "/>'
+ '</svg>';




var style = new ol.style.Style({
  image: new ol.style.Icon({
opacity: 1,
src: 'data:image/svg+xml;utf8,' + svg,
scale: 1
  })
});
Reply all
Reply to author
Forward
0 new messages