Metadata-Version: 1.0
Name: pykml
Version: 0.0.2
Summary: Python KML library
Home-page: http://pypi.python.org/pypi/pykml
Author: Tyler Erickson
Author-email: tylerickson@gmail.com
License: BSD
Description: =========
        PyKML
        =========
        PyKML is a Python package for parsing and authoring KML documents. It is based
        on the lxml.objectify API (http://codespeak.net/lxml/objectify.html) which
        provides Pythonic access to XML documents.
        
        ------------
        Dependencies
        ------------
        * lxml
        
        ------------
        Installation
        ------------
        PyKML can be installed from the Python Package Index, using either easy_install
        or pip:
        
        $ sudo easy_install pykml
        
        or
        
        $ sudo pip install pykml
        
        ------
        Usage
        ------
        
        KML documents can be constructed by using element factory objects.  The
        following example uses two factory objects, corresponding to the OGC KML and
        ATOM namespaces:
        
        >>> from pykml.kml_ogc.factory import KML_ElementMaker as K
        >>> from pykml.kml_ogc.factory import ATOM_ElementMaker as ATOM
        >>> doc = K.kml(
        ...         K.Document(
        ...           ATOM.author(
        ...             ATOM.name("J. K. Rowling")
        ...           ),
        ...           ATOM.link(href="http://www.harrypotter.com"),
        ...           K.Placemark(
        ...             K.name("Hogwarts"),
        ...             K.Point(
        ...               K.coordinates("1,1")
        ...             )
        ...           )
        ...         )
        ...       )
        
        Constructed documents can be converted to a string respresentation:
        
        >>> from lxml import etree
        >>> etree.tostring(doc)
        
        and can be validated against the official KML XML Schema:
        
        >>> from pykml.kml_ogc import schema
        >>> print schema.validate(doc)
        
        Existing KML documents can also be parsed:
        
        >>> import urllib2
        >>> from pykml.kml_ogc.parser import parse
        >>> url = 'http://code.google.com/apis/kml/documentation/KML_Samples.kml'
        >>> fileobject = urllib2.urlopen(url)
        >>> tree = parse(fileobject, validate=True)
        
        Documents that make use of the Google Extension namespace elements can be
        created by importing the appropriate factory objects:
        
        >>> from pykml.kml_gx import schema
        >>> from pykml.kml_gx.factory import KML_ElementMaker as K
        >>> from pykml.kml_gx.factory import ATOM_ElementMaker as ATOM
        >>> from pykml.kml_gx.factory import GX_ElementMaker as GX
        >>> doc = K.kml(
        ...       GX.Tour(
        ...         GX.Playlist(
        ...           GX.SoundCue(
        ...             K.href("http://dev.keyhole.com/codesite/cntowerfacts.mp3")
        ...           ),
        ...           GX.Wait(
        ...             GX.duration(10)
        ...           ),
        ...           GX.FlyTo(
        ...             GX.duration(5),
        ...             GX.flyToMode("bounce"),
        ...             K.LookAt(
        ...               K.longitude(-79.387),
        ...               K.latitude(43.643),
        ...               K.altitude(0),
        ...               K.heading(-172.3),
        ...               K.tilt(10),
        ...               K.range(1200),
        ...               K.altitudeMode("relativeToGround"),
        ...             )
        ...           )
        ...         )
        ...       )
        ... )
        >>> print schema.validate(doc)
        
        
Keywords: kml
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Topic :: Multimedia :: Graphics :: Viewers
Classifier: Topic :: Scientific/Engineering :: GIS
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Software Development :: Libraries :: Python Modules
