Changeset 1110
- Timestamp:
- 06/17/08 16:34:11
- Files:
-
- geojsonlib/trunk/geojson/base.py (modified) (2 diffs)
- geojsonlib/trunk/geojson/crs.py (modified) (1 diff)
- geojsonlib/trunk/geojson/encoding.py (modified) (2 diffs)
- geojsonlib/trunk/geojson/factory.py (modified) (1 diff)
- geojsonlib/trunk/geojson/feature.py (modified) (1 diff)
- geojsonlib/trunk/geojson/geometry.py (modified) (2 diffs)
- geojsonlib/trunk/geojson/mapping.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
geojsonlib/trunk/geojson/base.py
r1063 r1110 1 1 2 from geojson .mapping import is_mapping, to_mapping3 import geojson 4 import geojson .factory2 from geojsonlib.mapping import is_mapping, to_mapping 3 import geojsonlib 4 import geojsonlib.factory 5 5 6 6 … … 53 53 try: 54 54 type_ = d.pop("type") 55 geojson _factory = getattr(geojson.factory, type_)56 if not issubclass(geojson _factory, GeoJSON):55 geojsonlib_factory = getattr(geojsonlib.factory, type_) 56 if not issubclass(geojsonlib_factory, GeoJSON): 57 57 raise TypeError("""\ 58 58 Not a valid GeoJSON type: 59 %r (geojson _factory: %r, cls: %r)60 """ % (type_, geojson _factory, cls))61 instance = geojson _factory(**d)59 %r (geojsonlib_factory: %r, cls: %r) 60 """ % (type_, geojsonlib_factory, cls)) 61 instance = geojsonlib_factory(**d) 62 62 except (AttributeError, KeyError), invalid: 63 63 if not strict: geojsonlib/trunk/geojson/crs.py
r1064 r1110 1 1 2 2 3 from geojson .base import GeoJSON3 from geojsonlib.base import GeoJSON 4 4 5 5 geojsonlib/trunk/geojson/encoding.py
r1063 r1110 8 8 9 9 import simplejson 10 import geojson 11 import geojson .factory12 from geojson .mapping import Mapping, to_mapping10 import geojsonlib 11 import geojsonlib.factory 12 from geojsonlib.mapping import Mapping, to_mapping 13 13 14 14 … … 23 23 type_str = d.pop("type", None) 24 24 if type_str: 25 geojson _factory = getattr(geojson.factory, type_str, geojson.factory.GeoJSON)26 d = geojson _factory(**d).__geo_interface__25 geojsonlib_factory = getattr(geojsonlib.factory, type_str, geojsonlib.factory.GeoJSON) 26 d = geojsonlib_factory(**d).__geo_interface__ 27 27 return d 28 28 geojsonlib/trunk/geojson/factory.py
r1063 r1110 1 from geojson .geometry import Point, LineString, Polygon2 from geojson .geometry import MultiLineString, MultiPoint, MultiPolygon3 from geojson .geometry import GeometryCollection4 from geojson .feature import Feature, FeatureCollection5 from geojson .base import GeoJSON6 from geojson .crs import Named, Linked1 from geojsonlib.geometry import Point, LineString, Polygon 2 from geojsonlib.geometry import MultiLineString, MultiPoint, MultiPolygon 3 from geojsonlib.geometry import GeometryCollection 4 from geojsonlib.feature import Feature, FeatureCollection 5 from geojsonlib.base import GeoJSON 6 from geojsonlib.crs import Named, Linked 7 7 8 8 name = Named geojsonlib/trunk/geojson/feature.py
r1054 r1110 12 12 """ 13 13 14 from geojson .base import GeoJSON15 import geojson .geometry14 from geojsonlib.base import GeoJSON 15 import geojsonlib.geometry 16 16 17 17 class Feature(GeoJSON): geojsonlib/trunk/geojson/geometry.py
r1064 r1110 1 from geojson .base import GeoJSON2 import geojson .crs1 from geojsonlib.base import GeoJSON 2 import geojsonlib.crs 3 3 4 4 … … 10 10 super(Geometry, self).__init__(**extra) 11 11 self.coordinates = coordinates or [] 12 self.crs = self.to_instance(crs, default=geojson .crs.Default, strict=True)12 self.crs = self.to_instance(crs, default=geojsonlib.crs.Default, strict=True) 13 13 14 14 @property geojsonlib/trunk/geojson/mapping.py
r1040 r1110 22 22 class Mapping(object): 23 23 24 """Define what a ``mapping`` is to geojson .24 """Define what a ``mapping`` is to geojsonlib. 25 25 26 26 Until py3k, where we have abstract base classes, this will have to do.
