简体   繁体   English

在Mac和Iphone上未显示OpenLayers layer.vector

[英]OpenLayers layer.vector not showing on Mac and Iphone

i want to show the Map of 'Germany' with its borders on a website. 我想在网站上显示带有边框的“德国”地图。 Using Windows 10 and Firefox everything is working fine, but under Mac OS and iPhone the layer.vector is not showing. 使用Windows 10和Firefox时,一切工作正常,但在Mac OS和iPhone中,layer.vector没有显示。 Any ideas? 有任何想法吗?

<script>
  var fill = new ol.style.Fill({
    color: 'rgba(30,144,255,0.2)'
  });

  var stroke = new ol.style.Stroke({
    color: '#1E90FF',
    width: 2
  });

  var style = new ol.style.Style({
    fill: fill,
    stroke: stroke
  });

  var vectorLayer = new ol.layer.Vector({
    source: new ol.source.Vector({
      url: '[URL TO JSON]',
      format: new ol.format.GeoJSON()
      }),
    style: style
  });

  var map = new ol.Map({
    layers: [
        new ol.layer.Tile({
            source: new ol.source.OSM()
        }),
        vectorLayer

    ],
    target: 'map',
    view: new ol.View({
      center: ol.proj.fromLonLat([5.9688, 51.0852]),
      zoom: 5
    })
  });

top: Windows 10 + Firefox 顶部:Windows 10 + Firefox

bottom: Mac OS + Firefox/Safari 底部:Mac OS + Firefox / Safari

在此处输入图片说明

forget about this question. 忘记这个问题。 It was my fault. 这都是我的错。 I got this running with XAMPP locally on my Window 10 PC. 我在Window 10 PC上使用XAMPP在本地运行此程序。 The URL was something like localhost/... . 该URL类似于localhost / ...。 Yep, that caused the issue and i was blind and didnt see it for 2 days :D 是的,这引起了问题,我失明了,两天没看到它了:D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM