1

我正在尝试在我自己的服务器上实现这个示例。但它不能正常工作。当我点击绘图点时,有时图标不会出现。然后它给出了许多错误。是关于这里吗?

var points = [],
            msg_el = document.getElementById('msg'),
            url_osrm_nearest = 'https://router.project-osrm.org/nearest/v1/driving/',
            url_osrm_route = 'https://router.project-osrm.org/route/v1/driving/',
            icon_url = 'https://cdn.rawgit.com/openlayers/ol3/master/examples/data/icon.png',
            vectorSource = new ol.source.Vector(),
            vectorLayer = new ol.layer.Vector({
              source: vectorSource
            }),
            styles = {
              route: new ol.style.Style({
                stroke: new ol.style.Stroke({
                  width: 6, color: [40, 40, 40, 0.8]
                })
              }),
              icon: new ol.style.Style({
                image: new ol.style.Icon({
                  anchor: [0.5, 1],
                  src: icon_url
                })
              })
            };

我该如何解决?

4

0 回答 0