source: TI05-delivery/ows_framework/trunk/ows/common.py @ 2469

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows/common.py@2469
Revision 2469, 2.0 KB checked in by spascoe, 13 years ago (diff)

About half way through modelling OWS v1.1.0

Line 
1# Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council).
2# This software may be distributed under the terms of the
3# Q Public License, version 1.0 or later.
4# http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt
5"""
6Classes modelling the OWS common package v1.1.0.
7
8@author: Stephen Pascoe
9"""
10
11from ows.iso19115_subset import Keywords, LanguageString, Code
12
13class Metadata(object):
14    """
15    Terminology differences between the XML schema and the UML are confusing.
16    Here is a best-guess of sensible terms.
17   
18    @ivar content
19    @type content: Any object
20    @ivar link: URL as used in the metadata XML element's href attribute
21    @type link: None or str
22    @ivar about: URI as used in the metadata XML element's about attribute
23    @type about: None or str
24
25    """
26    def __init__(self, content=None, link=None, about=None):
27        self.content = content
28        self.link = link
29        self.about = about
30
31class BoundingBox(object):
32    """
33    @ivar lowerCorner
34    @type lowerCorner: sequence of numbers
35    @ivar upperCorner
36    @type upperCorner: sequence of numbers
37    @ivar crs: URI identifying the CRS unless included in a containing object
38    @type crs: None or str
39    @ivar dimensions: Number of dimensions
40    @type dimensions: int (positive)
41
42    """
43    def __init__(self, lowerCorner, upperCorner,
44                 crs=None):
45        if len(lowerCorner) != len(upperCorner):
46            raise ValueError, 'Corners have differing dimensionality'
47
48        self.lowerCorner = lowerCorner
49        self.upperCorner = upperCorner
50        self.crs = crs
51        self.dimensions = len(lowerCorner)
52
53class WGS84BoundingBox(BoundingBox):
54    """
55    Constrains BoundingBox to standard lat/lon CRS (WGS84).
56    """
57    def __init__(self, lowerCorner, upperCorner):
58        if len(lowerCorner) != 2 or len(upperCorner) != 2:
59            raise ValueError, 'Corners are not of dimension 2'
60       
61        BoundingBox.__init__(self, lowerCorner, upperCorner,
62                             crs='um:ogc:def:crs:OGC::84')
Note: See TracBrowser for help on using the repository browser.