Open sgillies opened 9 years ago
Proposal: make the standard feature collection properties (features excepted) into rw Python properties, like
FeatureStream().bbox
and add __getitem__
access for the non standard properties.
FeatureStream()['query']
Ever use the feedparser module? Kinda like that.
When writing, I'm pretty sure we'll want to close the set of collection properties before we send any features in, so something like this:
with open('example.json', 'w') as f, FeatureStream(f, a_property=True) as dst:
# effectively dst['a_property'] == True
dst.send(ftr)
@sgillies Can you point me to a list of the standard properties? Not sure how I feel about the mixed syntax but its not a bad solution to separating user defined properties. I'll have to take a look at feedparser
.
@geowurster anything that is a MUST or SHOULD in https://tools.ietf.org/html/draft-butler-geojson-06#section-2 ('type', 'bbox', 'id', 'geometry', 'coordinates', etc) could be a Python property. A Geometry class should remain lightweight, something like:
class Geometry(dict):
@property
def coordinates(self):
return self.get('coordinates')
@sgillies Thanks. I sketched out a bit of this in #1.
This is something to be discussed in https://github.com/geojson/geojson-feature-sequences, but I want to start to think about it concretely here, too. There are applications that give properties to GeoJSON feature collections. The
bbox
is standard. Several geocoding APIs add aquery
property. Can we do the same for feature sequences? How?