我找不到在规范的任何相关信息:http://geojson.org/geojson-spec.htmlGeoJSON:FeatureCollection中允许属性?
它是允许有一个FeatureCollection
一个properties
关键?或者只有特征才有可能?
如果有可能,我怎么能访问内openlayers
的属性? 在此先感谢。
我找不到在规范的任何相关信息:http://geojson.org/geojson-spec.htmlGeoJSON:FeatureCollection中允许属性?
它是允许有一个FeatureCollection
一个properties
关键?或者只有特征才有可能?
如果有可能,我怎么能访问内openlayers
的属性? 在此先感谢。
规范并不禁止这样明确,但是要素集合不具备的特性。以GeoJSON规范只提到了的FeatureCollection以下键:
type
- 必须是`的FeatureCollectionfeatures
- feauresbbox
的阵列 - 边界全要素集合的框,我请参阅OpenLayers代码,properties
仅针对要素实例进行处理,而不针对要素集合进行处理。
切换到单张更容易,它接受GeoJSON的用的FeatureCollection。当您单击对象时,您还可以获取Popup中的属性。
但是,Openlayers也可以访问FeatureCollection。 Mobile(jQuery Mobile)Openlayers示例演示了访问属性。
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]}
}
]
}