以下で構成される 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/で実行すると、検証されます。
これがどのように可能か知っている人はいますか?