Geojson 1.0
We're done: http://pypi.python.org/pypi/geojson/1.0. Matt Russell from Sanoodi did most of the coding while I was editing the spec, and Eric Lemoine from Camptocamp helped us crush bugs.
Geojson provides geometry, feature, and collection classes, and supports pickle-style dump and load of objects that provide the lab's Python geo interface. Here's an example of a round-trip through the GeoJSON format:
>>> import geojson >>> p = geojson.Point([0.0, 0.0]) >>> p Point(coordinates=[0.0, 0.0]) >>> data = geojson.dumps(p) >>> data '{"type": "Point", "coordinates": [0.0, 0.0]}' >>> q = geojson.loads(data, object_hook=geojson.GeoJSON.to_instance) >>> q Point(coordinates=[0.0, 0.0])
The geometry classes interoperate with Shapely via the geo interface:
>>> from shapely.geometry import asShape >>> x = asShape(p) >>> x.wkt 'POINT (0.0000000000000000 0.0000000000000000)'
For more details, please see the project page at http://trac.gispython.org/lab/wiki/GeoJSON. Share and enjoy.