Custom icon with QGIS and openlayers

المشرف العام

Administrator
طاقم الإدارة
I've made a map with QGIS and I've tried to convert it to openlayers with the plugin qgis2web. Originally, the point layer has a custom icon made by me and it's an svg file, but when I export the map, it hasn't that icon and it seems to disappear.I tried to export the map with the point layer with default icon and it's all ok so, reading the ol3 documentation I tried to change the file style in this way:original code

var style = [ new ol.style.Style({ image: new ol.style.Circle({radius: 5.0, stroke: new ol.style.Stroke({ color: 'rgba(0,0,0,255)', lineDash: null, width: 1}), fill: new ol.style.Fill({ color: "rgba(0,0,0,1.0)"})}) }) ];​
modified code

var style = [ new ol.style.Style({ image: new ol.style.Icon({ anchor: [0.5, 0.5], size: [50, 50], offset: [0, 0], opacity: 1, src: 'x.png' })}) ];​
It doesn't work. I'm not a ol expert, is it possible to do something like I want to do? Am I doing something wrong?Previously I did the same thing with qgis2leaf and all was right adding a columns called icon_exp in the attribute table in qgis, but I need some rotated maps, so I need of ol.



أكثر...
 
أعلى