未捕获(在承诺中)TypeError:无法获取错误

时间:2017-05-14 07:15:43

标签: openlayers osrm

我正在尝试在自己的服务器上实现this示例。但它没有正常工作。当我点击绘制点时,有时图标不会出现。然后它会产生很多错误。它在这附近吗?

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
                })
              })
            };

我该如何解决?

0 个答案:

没有答案