Closed alexlouden closed 11 years ago
First, the geojson package is no longer in development. Second, I'm -1 on Markdown because PyPI prefers RestructuredText. This pull request also breaks setup.py.
Are you using geojson in production anywhere? Does it do anything for you that Python's json doesn't?
Hi Sean,
I was under the impression that geojson was the recommended method of JSON serialising Shapely geometries. (From your blog - http://sgillies.net/blog/478/shapely-geometries-for-python/)
I've used it in a prototype, but not in production yet. I'm happy to fix setup.py (oops, sorry!), and use .rst instead. I could also set up Travis CI for unit testing to ensure future pull requests don't break anything else.
Thanks for your response and for Shapely, deacartes and geojson - these packages have saved me a great deal of time!
Today, I think the best way to serialize Shapely geometries is this:
>>> import json
>>> from shapely.geometry import Point, shape, mapping
>>> pt1 = Point(-105, 40)
>>> pt2 = shape(json.loads(json.dumps(mapping(pt))))
>>> pt1.equals(pt2)
True
mapping() makes a mapping from a geometry and shape() makes a geometry from a mapping. Sort of like dumps and loads.
The geojson package was originally designed to be a reference implementation of the GeoJSON format. It took on a life of its own for a while, but is mostly obsolete now.
Ah okay, I'll use mapping() instead. If it's obsolete may I suggest that a note is added to the documentation?
Cheers!
I ended up creating a custom JSONEncoder and Decoder, so that I could use Shapely geometries in a larger data structure - see https://gist.github.com/alexlouden/5385305#file-shapely_json-py
Is there any reason why this library should cease to exist even if Shapely exists? I like the simplicity of this library and can offer to contribute in improving the documentation
@frewsxcv I'm going to close this particular issue, but please do send another for documentation fixes and then we should talk about making you a maintainer, because this package will need a new one if it's to live on.
@sgillies Any change I could get involved in keeping this project alive / becoming a maintainer?
Updated from text description to markdown