__geo_interface__ support #493
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This changes adds
__geo_interface__
support: https://gist.github.com/sgillies/2217756The geo_interface is a method of exchanging geospatial data between applications. For example, it makes it directly possible to read into geopandas:
or with shapely:
or with any other package which supports geo_interface
As part of this I've changed added to the behaviour of
WaterNetworkModel.junctions
, pipes, etc. to act as a Mapping, which also implements the geo_interface, but which also maintains the existing behaviour when called. ( this means that their behaviour is more similar to WaterNetworkModel.nodes and links ).This doesn't replace the gis modules (although it could be used to simplify the logic within to_gis()). It also doesn't require any dependencies.
As part of this I created a common class for both Node and Link to inherit from, and moved some of the shared methods over to it. In passing, I have also removed some other old uses of the
six
package and uses ofObject
.Tests and documentation
I have not yet written the tests and document - I will do some refinements, writing tests and adding to the documentation if you agree in principle to the changes so far.
Acknowledgement
By contributing to this software project, I acknowledge that I have reviewed the software quality assurance guidelines and that my contributions are submitted under the Revised BSD License.