root/zgeo.geographer/trunk/zgeo/geographer/interfaces.py

Revision 1266 (checked in by seang, 3 months ago)

Fix zgeo namespace

Line 
1 from zope.interface import Attribute, Interface
2 from zope.deprecation import deprecated
3
4
5 class IGeoreferenceable(Interface):
6    
7     """Marks classes that may be annotated with georeferencing properties.
8     """
9
10
11 class IGeoInterface(Interface):
12
13     """Provides the Python geo interface.
14
15     See http://trac.gispython.org/projects/PCL/wiki/PythonGeoInterface
16     for details.
17     """
18
19     __geo_interface__ = Attribute("""Python Geo Interface""")
20
21
22 class IGeoreferenced(Interface):
23
24     """A geographically referenced object.
25
26     The spatial reference system is implicitly long, lat WGS84. Geometry types
27     and coordinates shall follow the Python geo interface specification, which
28     itself tracks the GeoJSON draft specification at http://geojson.org.
29     """
30
31     type = Attribute(
32         """The name of the geometry type: 'Point', 'LineString', 'Polygon'"""
33         )
34     coordinates = Attribute("""A sequence of coordinate tuples""")
35     crs = Attribute("""A coordinate reference system as a dict.
36         The default is decimal degree longitude and latitude using the
37         WGS 1984 reference system.""")
38
39
40 class IWritableGeoreference(Interface):
41
42     def setGeoInterface(type, coordinates, crs):
43         """Set the geometry via the geo interface."""
44
45
46 class IWriteGeoreferenced(IGeoreferenced, IWritableGeoreference):
47     """Supports read/write georeferencing.
48     """
49
50
51 # TODO: deprecate the interfaces below. they really aren't needed. IGeoItem
52 # and IGeoCollection will be better implement in views of other packages.
53
54 class IGeometry(IGeoInterface):
55
56     """A geometry property with a geographic or projected coordinate system.
57
58     The spatial reference system is implicitly long, lat WGS84. Geometry types
59     and coordinates shall follow the Python geo interface specification, which
60     itself tracks the GeoJSON draft specification at http://geojson.org.
61     """
62
63     type = Attribute(
64         'The name of the geometry type: "Point", "LineString", or "Polygon"'
65         )
66
67     coordinates = Attribute('A sequence of coordinate tuples')
68
69
70 class IGeoItem(IGeoInterface):
71
72     """A simple georeferenced object, analogous to an entry in GeoRSS, or a
73     KML placemark.
74     """
75
76     id = Attribute('Unique identifier for the item')
77
78     properties = Attribute('Mapping of item properties')
79
80     geometry = Attribute('An object that provides IGeometry (above)')
81
82
83
84 class IGeoCollection(IGeoInterface):
85
86     """A collection of objects that provide IGeoItem, analogous to an Atom
87     feed or a KML folder.
88     """
89
90     features = Attribute('Iterator over objects that provide IGeoItem')
91
92
93 deprecated(
94     'IGeometry',
95     'IGeometry will be removed from zgeo.geographer 1.0'
96     )
97
98 deprecated(
99     'IGeoItem',
100     'IGeoItem will be removed from zgeo.geographer 1.0'
101     )
102
103 deprecated(
104     'IGeoCollection',
105     'IGeoCollection will be removed from zgeo.geographer 1.0'
106     )
107
Note: See TracBrowser for help on using the browser.