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

Shape to geojson #51

Merged
merged 3 commits into from Dec 5, 2018
Merged

Shape to geojson #51

merged 3 commits into from Dec 5, 2018

Conversation

thekaveman
Copy link
Contributor

New version of #48.

Closes #47.

johnclary and others added 3 commits November 21, 2018 02:04
Use shapely.geomtery.mapping to convert shapely geomtry objects to geojson dicts, dropping geopandas dependency.
@thekaveman thekaveman merged commit 95fa210 into dev Dec 5, 2018
@thekaveman thekaveman added this to the 0.2.0 milestone Dec 6, 2018
if isinstance(shape, Point) and "bbox" in feature:
del feature["bbox"]
if isinstance(shape, Point):
feature["coordinates"] = list(feature["coordinates"])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious -- why is it important that the results are python lists rather than tuples?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnclary want to chime in with any thoughts?

@ezheidtmann is there a performance or other consideration we should be aware of here? The only thing that comes to my mind is the schema validation - will a tuple pass where a list does currently? I don't know.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tuples and lists are equivalent after they've been serialized to JSON, so hopefully jsonschema doesn't care. Generally tuples use less memory but I ask because if tuples are acceptable, this function becomes a lot simpler.

@thekaveman thekaveman deleted the shape-to-geojson branch December 13, 2018 20:39
thekaveman added a commit that referenced this pull request Dec 31, 2018
* Convert shapely to geojson dict

* minor import cleanups

* removing geopandas install_requires
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.

None yet

3 participants