简体   繁体   中英

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. 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

bottom: Mac OS + Firefox/Safari

在此处输入图片说明

forget about this question. It was my fault. I got this running with XAMPP locally on my Window 10 PC. The URL was something like localhost/... . Yep, that caused the issue and i was blind and didnt see it for 2 days :D

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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