Geojson and pyproj interop
I've just finished writing a module that supports projection of objects that provide the geometry part of the Lab's geo interface: proj.py. Maybe you'll find it useful. What it does is take a geojson geometry (or Shapely geometry) and return a new projected geojson geometry object:
>>> from pleiades.openlayers.proj import Transform, PROJ_900913 >>> transform = Transform(PROJ_900913) >>> # Point, forward >>> from geojson import Point >>> point = Point(coordinates=(25.0, 25.0)) >>> fwd = transform(point) >>> fwd Point(coordinates=(2782987.269831839, 2875744.6243522423)) >>> # Point, inverse >>> inv = transform(fwd, inverse=True) >>> inv Point(coordinates=(24.999999999999996, 24.999999999999996)) >>> # Line, forward >>> from geojson import LineString >>> line = LineString(coordinates=((25.0, 25.0), (30.0, 30.0))) >>> fwd = transform(line) >>> fwd LineString(coordinates=((2782987.269831839, 2875744.6243522423), ...)) >>> # Line, inverse >>> inv = transform(fwd, inverse=True) >>> inv LineString(coordinates=((24.999999999999996, 24.999999999999996), ...))
There's also an object hook if you'd like the transform to yield instances of your own classes.