Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/433.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 显示标记的GeoJSON同源策略映射框_Javascript_Mapbox_Geojson - Fatal编程技术网

Javascript 显示标记的GeoJSON同源策略映射框

Javascript 显示标记的GeoJSON同源策略映射框,javascript,mapbox,geojson,Javascript,Mapbox,Geojson,Im在使用Mapbox和编码方面是新手。所以我在mapbox上尝试了这些例子。。有一个关于如何在地图中使用GeoJSON的指南。当我复制这个例子时,一切都很好。当我尝试使用自己的MapID和.geojson文件进行此操作时,它不会显示我使用qeojson所做的标记 这可能与原产地相同的政策有关,但我不知道如何解决这个问题 L.mapbox.accessToken = 'xxxxxxxxxxxxxxxxxxxxxxx'; var map = L.mapbox.map('arnojansens.m6

Im在使用Mapbox和编码方面是新手。所以我在mapbox上尝试了这些例子。。有一个关于如何在地图中使用GeoJSON的指南。当我复制这个例子时,一切都很好。当我尝试使用自己的MapID和.geojson文件进行此操作时,它不会显示我使用qeojson所做的标记

这可能与原产地相同的政策有关,但我不知道如何解决这个问题

L.mapbox.accessToken = 'xxxxxxxxxxxxxxxxxxxxxxx';
var map = L.mapbox.map('arnojansens.m67ea8oe', 'mapbox.streets', {doubleClickZoom: false})
    .setView([50.93274, 4.21793], 17);
    map.on('dblclick', function(e) {
        alert(e.latlng);
    });
map.zoomControl.setPosition('topright');

var featureLayer = L.mapbox.featureLayer()
.loadURL('/data/map.geojson')
.addTo(map);


您是将其加载到文件:///协议还是实际的本地服务器上?另外,向我们展示您的geojson文件。@snkashis我有一个包含index.html的主文件夹和一个数据文件夹。数据文件夹中是geojson文件。我已经更新了,所以geojson现在也可以看到了。好的,那么如何打开index.html呢?作为一个文件,或者在本地地址(如localhost/0.0.0.0?@snkashis)上导航到它。我将它作为一个文件打开。是的,这可能是个问题。我建议通过本地web服务器运行它。查看node.js service()或
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "id": "marker-i9o53vrk1",
        "title": "'T Gouden Frietje",
        "description": "Frituur - Pol & Johan ",
        "marker-size": "large",
        "marker-color": "#f5c272",
        "marker-symbol": "fast-food"
      },
      "geometry": {
        "coordinates": [
          4.223376,
          50.933714
        ],
        "type": "Point"
      },
      "id": "ci9o5l91s03f8kwm4crz7akr4"
    },
    {
      "type": "Feature",
      "properties": {
        "id": "marker-i9o5cke12",
        "title": "Beenhouwerij",
        "description": "",
        "marker-size": "large",
        "marker-color": "#e7857f",
        "marker-symbol": "slaughterhouse"
      },
      "geometry": {
        "coordinates": [
          4.223685,
          50.933713
        ],
        "type": "Point"
      },
      "id": "ci9o5l91u03f9kwm4f0qapngb"
    },
    {
      "type": "Feature",
      "properties": {
        "id": "marker-i9o5f2gp3",
        "title": "Beenhouwerij",
        "description": "",
        "marker-size": "large",
        "marker-color": "#e7857f",
        "marker-symbol": "slaughterhouse"
      },
      "geometry": {
        "coordinates": [
          4.216918,
          50.933488
        ],
        "type": "Point"
      },
      "id": "ci9o5l91v03fakwm434twwv2l"
    },
    {
      "type": "Feature",
      "properties": {
        "id": "marker-i9o5g6ik4",
        "title": "Lagere school",
        "description": "",
        "marker-size": "large",
        "marker-color": "#3ca0d3",
        "marker-symbol": "college"
      },
      "geometry": {
        "coordinates": [
          4.225055,
          50.932756
        ],
        "type": "Point"
      },
      "id": "ci9o5l91x03fbkwm4wt0bb2e3"
    },
    {
      "type": "Feature",
      "properties": {
        "id": "marker-i9o5gtqc5",
        "title": "Scouts Mollem",
        "description": "",
        "marker-size": "large",
        "marker-color": "#7ec9b1",
        "marker-symbol": "pitch"
      },
      "geometry": {
        "coordinates": [
          4.225434,
          50.932496
        ],
        "type": "Point"
      },
      "id": "ci9o5l91y03fckwm405qiiy8h"
    },
    {
      "type": "Feature",
      "properties": {
        "id": "marker-i9o5hmw16",
        "title": "Basketbalveld",
        "description": "",
        "marker-size": "large",
        "marker-color": "#677da7",
        "marker-symbol": "basketball"
      },
      "geometry": {
        "coordinates": [
          4.224787,
          50.932234
        ],
        "type": "Point"
      },
      "id": "ci9o5l91z03fdkwm40nbu93kt"
    },
    {
      "type": "Feature",
      "properties": {
        "id": "marker-i9o5ilk57",
        "title": "Kerk Mollem",
        "description": "",
        "marker-size": "large",
        "marker-color": "#6c6c6c",
        "marker-symbol": "religious-christian"
      },
      "geometry": {
        "coordinates": [
          4.226949,
          50.930707
        ],
        "type": "Point"
      },
      "id": "ci9o5l92003fekwm4zfk58zsc"
    },
    {
      "type": "Feature",
      "properties": {
        "id": "marker-i9o5j7yl8",
        "title": "Trapkes op",
        "description": "",
        "marker-size": "large",
        "marker-color": "#f1f075",
        "marker-symbol": "beer"
      },
      "geometry": {
        "coordinates": [
          4.227024,
          50.93059
        ],
        "type": "Point"
      },
      "id": "ci9o5l92103ffkwm4bg2ygo9r"
    },
    {
      "type": "Feature",
      "properties": {
        "id": "marker-i9o5kmqz9",
        "title": "Voetbal Mollem",
        "description": "",
        "marker-size": "large",
        "marker-color": "#f86767",
        "marker-symbol": "soccer"
      },
      "geometry": {
        "coordinates": [
          4.223084,
          50.928709
        ],
        "type": "Point"
      },
      "id": "fff"
    }
  ],
  "id": "arnojansens.m67ea8oe"
}