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

Consolidate GeoJSON feature stream I/O #252

Closed
wants to merge 1 commit into from
Closed

Consolidate GeoJSON feature stream I/O #252

wants to merge 1 commit into from

Conversation

geowurster
Copy link
Member

In progress. Feedback welcome.

@sgillies This is a rough draft (without unittests) of #251 that implements a new fiona.collections.FeatureStream() file-like object for working with GeoJSON feature streams. If it is decided that this object doesn't really belong in Fiona, this about how I planned on implementing Toblerity/fio-buffer#4, so feel free to shoot this down.

Generate some sample data

$ fio cat tests/data/coutwildrnp.shp > features.geojson

Inspect it with Python

import fiona
with fiona.open('features.geojson', sequence=True) as src:
    print(next(src))

RS prefixes are supported as well as reading from stdin and writing to stdout:

import fiona
with fiona.open('-', sequence=True) as src, fiona.open('-', 'w', sequence=True, use_rs=True) as dst:
    for feat in src:
        dst.write(feat)

@sgillies
Copy link
Member

@geowurster Let's develop an IO-like class for GeoJSON streams in a different project. It won't require GDAL/OGR, and might get wider use if it didn't entail GDAL. Additionally, there are a few things to figure out yet about feature sequences (geojson/draft-geojson#64 for reference), and we can go faster and more recklessly outside of Fiona :)

@geowurster
Copy link
Member Author

@sgillies Sounds good. I'll drop this in fio-buffer for now but feel free to find me when you get a repo set up for general purpose GeoJSON IO.

@geowurster
Copy link
Member Author

@sgillies Would it be helpful if I worked this into a PR for py-feature-sequences to start a discussion?

@sgillies
Copy link
Member

sgillies commented Aug 2, 2015

@geowurster 👍

https://github.com/geojson/py-feature-sequences is the new repo. I'll make sure you've got write perms.

@geowurster
Copy link
Member Author

@sgillies I'm in. Thanks!

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

Successfully merging this pull request may close these issues.

2 participants