存储在geoJSON中的点不会显示在地图上


points stored in geoJSON do not show up on map

我有一个geoJSON文件,包含:

{
"type": "FeautureCollection",
"features": [
    {
        "type": "Feature",
        "id": "1",
        "geometry": {
            "type": "Point",
            "coordinates": [
                5.709531,
                50.855802
            ]
        }
    },
    {
        "type": "Feature",
        "id": "2",
        "geometry": {
            "type": "Point",
            "coordinates": [
                5.709426,
                50.855798
            ]
        }
    }
]
}

这个JSON文件是用php脚本构建的:

$ret = array();
$ret['type'] = "FeautureCollection";
$ret['features'] = array();
$f = array();
$f['type'] = 'Feature';
$f['id'] = $p['id'];
$f['geometry'] = array();
$f['geometry']['type'] = 'Point';
$f['geometry']['coordinates'] = array(floatval($p['lat']), floatval($p['lon']));
  $ret['features'][] = $f;
echo json_encode($ret);

当我试图通过polymaps.org框架加载它时,没有显示任何点。除了加载地图的标准内容外,我还使用这个javascript来解析geoJSON。

map.add(po.geoJson()
.url('geojson/c.geo.php')
.id('test')
);

CSS如下,因此这些点看起来应该像一个红色圆圈:

#test {
      fill: lightcoral;
      fill-opacity: .5;
      stroke: brown;
    }

奇怪的是,当我将geojson文件指针更改为GIS应用程序构建的指针时,它就可以工作了。所以我打赌我的geoJSON已经损坏了。但当我跑过去的时候http://jsonlint.com/它验证了。

有人知道这怎么可能吗?

不确定,但我想我曾经在另一个框架中遇到过同样的问题:http://leaflet.cloudmade.com/

就我而言,这是一个视角位置的问题(例如:你的特写在美国,但你的地图显示的是非洲)。同样在云制作的传单中,他们使用经纬度而不是经纬度。

你可以检查你的地图是否显示了正确的区域。