Exemple #1
0
#

import time

from operator import attrgetter

from lxml import etree

from upoints import (point, utils)
from upoints._version import web as ua_string


GPX_NS = 'http://www.topografix.com/GPX/1/1'
etree.register_namespace('gpx', GPX_NS)

create_elem = utils.element_creator(GPX_NS)

GPX_ELEM_ATTRIB = {
    'creator': ua_string,
    'version': '1.1',
    '{http://www.w3.org/2001/XMLSchema-instance}schemaLocation': '%s http://www.topografix.com/GPX/1/1/gpx.xsd' % GPX_NS,
}

class _GpxElem(point.TimedPoint):

    """Abstract class for representing an element from GPX data files.

    .. versionadded:: 0.11.0
    """

    __slots__ = ('name', 'description', 'elevation', 'time', )
Exemple #2
0
#

from operator import attrgetter

try:
    from urllib.request import urlopen
except ImportError:  # Python 2
    from urllib import urlopen

from lxml import etree

from upoints import (point, utils)
from upoints._version import web as ua_string
from upoints.compat import mangle_repr_type

create_elem = utils.element_creator()


def _parse_flags(element):
    """Parse OSM XML element for generic data.

    :param etree.Element element: Element to parse
    :rtype: ``tuple``
    :return: Generic OSM data for object instantiation
    """
    visible = True if element.get('visible') else False
    user = element.get('user')
    timestamp = element.get('timestamp')
    if timestamp:
        timestamp = utils.Timestamp.parse_isoformat(timestamp)
    tags = {}
Exemple #3
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import logging

from lxml import etree

from upoints import (point, trigpoints, utils)

KML_NS = 'http://earth.google.com/kml/2.2'
etree.register_namespace('kml', KML_NS)

create_elem = utils.element_creator(KML_NS)


class Placemark(trigpoints.Trigpoint):

    """Class for representing a Placemark element from KML data files.

    .. versionadded:: 0.6.0
    """

    __slots__ = ('description', )

    def __init__(self, latitude, longitude, altitude=None, name=None,
                 description=None):
        """Initialise a new ``Placemark`` object.