/gdata/geo/data.py
Python | 92 lines | 34 code | 31 blank | 27 comment | 0 complexity | d587ea0ff49af727cb6d63d65759ac52 MD5 | raw file
1#!/usr/bin/python 2# 3# Copyright (C) 2009 Google Inc. 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17"""Contains the data classes of the Geography Extension""" 18 19 20__author__ = 'j.s@google.com (Jeff Scudder)' 21 22 23import atom.core 24 25 26GEORSS_TEMPLATE = '{http://www.georss.org/georss/}%s' 27GML_TEMPLATE = '{http://www.opengis.net/gml/}%s' 28GEO_TEMPLATE = '{http://www.w3.org/2003/01/geo/wgs84_pos#/}%s' 29 30 31class GeoLat(atom.core.XmlElement): 32 """Describes a W3C latitude.""" 33 _qname = GEO_TEMPLATE % 'lat' 34 35 36class GeoLong(atom.core.XmlElement): 37 """Describes a W3C longitude.""" 38 _qname = GEO_TEMPLATE % 'long' 39 40 41class GeoRssBox(atom.core.XmlElement): 42 """Describes a geographical region.""" 43 _qname = GEORSS_TEMPLATE % 'box' 44 45 46class GeoRssPoint(atom.core.XmlElement): 47 """Describes a geographical location.""" 48 _qname = GEORSS_TEMPLATE % 'point' 49 50 51class GmlLowerCorner(atom.core.XmlElement): 52 """Describes a lower corner of a region.""" 53 _qname = GML_TEMPLATE % 'lowerCorner' 54 55 56class GmlPos(atom.core.XmlElement): 57 """Describes a latitude and longitude.""" 58 _qname = GML_TEMPLATE % 'pos' 59 60 61class GmlPoint(atom.core.XmlElement): 62 """Describes a particular geographical point.""" 63 _qname = GML_TEMPLATE % 'Point' 64 pos = GmlPos 65 66 67class GmlUpperCorner(atom.core.XmlElement): 68 """Describes an upper corner of a region.""" 69 _qname = GML_TEMPLATE % 'upperCorner' 70 71 72class GmlEnvelope(atom.core.XmlElement): 73 """Describes a Gml geographical region.""" 74 _qname = GML_TEMPLATE % 'Envelope' 75 lower_corner = GmlLowerCorner 76 upper_corner = GmlUpperCorner 77 78 79class GeoRssWhere(atom.core.XmlElement): 80 """Describes a geographical location or region.""" 81 _qname = GEORSS_TEMPLATE % 'where' 82 Point = GmlPoint 83 Envelope = GmlEnvelope 84 85 86class W3CPoint(atom.core.XmlElement): 87 """Describes a W3C geographical location.""" 88 _qname = GEO_TEMPLATE % 'Point' 89 long = GeoLong 90 lat = GeoLat 91 92