仕様に関連情報が見つかりませんでした: http://geojson.org/geojson-spec.html
properties
にキーを入れることはできFeatureCollection
ますか? それとも機能のみ可能ですか?
可能であれば、内のプロパティにアクセスするにはどうすればよいopenlayers
ですか? 前もって感謝します。
仕様に関連情報が見つかりませんでした: http://geojson.org/geojson-spec.html
properties
にキーを入れることはできFeatureCollection
ますか? それとも機能のみ可能ですか?
可能であれば、内のプロパティにアクセスするにはどうすればよいopenlayers
ですか? 前もって感謝します。
仕様では明示的に禁止されていませんが、フィーチャ コレクションにはプロパティがありません。GeoJSON 仕様では、FeatureCollection の次のキーのみが言及されています。
type
- `FeatureCollection でなければなりませんfeatures
- 機能の配列bbox
- 機能コレクション全体の境界ボックスOpenLayers コードからわかるようにproperties
、機能コレクションではなく、機能インスタンスに対してのみ処理されます。
Leaflet への切り替えは簡単で、FeatureCollection で GeoJSON を受け入れます。オブジェクトをクリックすると、ポップアップの属性も取得できます。
ただし、Openlayers も FeatureCollection にアクセスします。Openlayers のモバイル (jQuery Mobile) の例では、プロパティへのアクセスを示しました。
http://openlayers.org/dev/examples/mobile-jq.html#mappage
黒いアイコンをクリックすると、これらの属性を含むポップアップ フォームが表示されます。
これは、モバイルの例の GeoJSON の一部です。
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature",
"geometry": {"type": "Point","coordinates": [1332700, 7906300]},
"properties": {"Name": "Igor Tihonov","Country":"Sweden", "City":"Gothenburg"}
},
{ "type": "Feature",
"geometry": {"type": "Point","coordinates": [790300, 6573900]},
"properties": {"Name": "Marc Jansen","Country":"Germany", "City":"Bonn"}
},
{ "type": "Feature",
"geometry": {"type": "Point","coordinates": [568600, 6817300]},
"properties": {"Name": "Bart van den Eijnden","Country":"Netherlands", "City":"Utrecht"}
},
{ "type": "Feature",
"geometry": {"type": "Point","coordinates": [-7909900, 5215100]}
}
]
}