Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What about properties of collections? #3

Open
sgillies opened this issue Aug 13, 2015 · 4 comments
Open

What about properties of collections? #3

sgillies opened this issue Aug 13, 2015 · 4 comments

Comments

@sgillies
Copy link
Contributor

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 a query property. Can we do the same for feature sequences? How?

@sgillies
Copy link
Contributor Author

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)

@geowurster
Copy link
Member

@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.

@sgillies
Copy link
Contributor Author

@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')

@geowurster
Copy link
Member

@sgillies Thanks. I sketched out a bit of this in #1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants