Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GeoJSON: Are Properties allowed in FeatureCollection?

I could not find any relevant information in the spec: http://geojson.org/geojson-spec.html

Is it allowed to have a properties key in a FeatureCollection? Or is it only possible for Features?

If it's possible, how can I access the properties within openlayers? Thanks in advance.

like image 328
jllodra Avatar asked Jan 11 '12 14:01

jllodra


Video Answer


1 Answers

The specification does not forbid it explicitly, but feature collections do not have properties. GeoJSON spec only mentions the following keys for FeatureCollection:

  • type - must be `FeatureCollection
  • features - array of feaures
  • bbox - bounding box of the whole feature collection

As I see from OpenLayers code, properties is only processed for feature instances, not for the feature collection.

like image 55
lexicore Avatar answered Sep 20 '22 21:09

lexicore