来自geoJSON的Mapbox标记未出现在IE9中 [英] Mapbox markers from geoJSON not appearing in IE9

查看:266
本文介绍了来自geoJSON的Mapbox标记未出现在IE9中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从本地geoJSON文件加载标记的地图。这在我测试的所有浏览器(FF,Chrome,Safari,Opera,IE10,IE11)中都可以正常工作,但在IE9中没有。

I have a map that is loading markers from a local geoJSON file. This works fine in all browsers I have tested (FF, Chrome, Safari, Opera, IE10, IE11) but not in IE9.

我在地图上添加了一个标记而没有geoJSON(黄色巴士标记)确实在IE9中显示。

I added a marker to the map without geoJSON (the yellow bus marker) which does show up fine in IE9.

以下是相关代码:

    // set up mapbox
    var map = new L.mapbox.map('map', '########', {
        tileLayer: {
            detectRetina: true,
            minZoom: 2
        },
        zoomControl: false
    });

    // marker without geoJSON
    L.marker([-37.9, -77], {
        icon: L.mapbox.marker.icon({
            'marker-size': 'large',
            'marker-symbol': 'bus',
            'marker-color': '#fa0'
        })
    }).addTo(map);

    // markers with geoJSON
    var geoJsonData = L.mapbox.featureLayer().loadURL('http://nomacorc.cuberishosting.com/wp-content/themes/nomacorc/map-lib/sellers-locations.php').addTo(map);

您可以在以下位置看到一个有效的示例: http://nomacorc.cuberishosting.com/purchase-test/

You can see a working example at: http://nomacorc.cuberishosting.com/purchase-test/.

这是一个链接到geoJSON文件: http:// nomacorc .cuberishosting.com / wp-content / themes / nomacorc / map-lib / sellers-locations.php

Here is a link to the geoJSON file: http://nomacorc.cuberishosting.com/wp-content/themes/nomacorc/map-lib/sellers-locations.php

geoJSON本身似乎在为我验证 http://geojsonlint.com/

The geoJSON itself appeared to validate for me at http://geojsonlint.com/

推荐答案

看起来像是在loadURL函数中调用JSON的方式。我用AJAX拉出JSON来修复它:

Looks like it was something with the way the JSON was being called in the loadURL function. I pulled the JSON with AJAX to fix it like so:

    // url to file with geojson data
    var url = 'http://nomacorc.cuberishosting.com/wp-content/themes/nomacorc/map-lib/sellers-locations.php';

    // load geojson file
    $.getJSON(url, function(data) {

        var featureMarkers = L.mapbox.featureLayer(data, {sanitizer: function(string) {return string;}});

        // The rest of my code here...
    });

这篇关于来自geoJSON的Mapbox标记未出现在IE9中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆