Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is it valid to have a properties element with a featureCollection-element as parent?

This is, according to geojson.org valid:

{ "type": "FeatureCollection",
  "features": [
              { "type": "Feature",
                "geometry": {"type": "Point", "coordinates": [102.0, 0.5]},
                "properties": {"prop0": "value0"}
              }
              ]
}

But I can't find is it is valid nor if it is in-valid to have this:

{ "type": "FeatureCollection",
  "properties" : { "description" : "This is the geometry for..." }
  "features": [
              { "type": "Feature",
                "geometry": {"type": "Point", "coordinates": [102.0, 0.5]},
                "properties": {"prop0": "value0"}
              }
              ]
}

According to the answer underneath it is not in-valid to put it there, but programs/scripts won't know its there.

So, let me rephrase the question: (Where) Is it possible to put some descriptive information about the property as a total??

share|improve this question

1 Answer 1

up vote 2 down vote accepted

2.3. Feature Collection Objects

A GeoJSON object with the type "FeatureCollection" is a feature collection object.

An object of type "FeatureCollection" must have a member with the name "features". The value corresponding to "features" is an array. Each element in the array is a feature object as defined above.

I think this clearly implies that if the object has additional members that doesn't make it invalid.

Ecmascript objects are very open.

So yes, you can have a properties element at the top level of a feature collection, but don't expect any tools to know its there, or to copy it, ...

share|improve this answer
    
O.K. Fair enough :) But what is the place to store information about the collection itself instead of the feature? –  stUrb May 12 '12 at 8:24
    
There isn't one in the spec. –  Calvin May 17 '13 at 10:09
    
Because FeatureCollection is a first class object any properties will be about the collection, not any feature. Either add as many as you like, or add a "metadata" property whose value is a map. –  Julian May 19 at 15:39
    
Another way of thinking about it is that you need to sub-class FeatureCollection for your needs. That's really a metaphor rather than a programming construct here though because ECMAscript doesn't think of objects quite that way. –  Julian May 20 at 8:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.