Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(0)  |  Derive(0)  |  Import(2)
Make a KML element from an object that provides the Python geo   
interface.

Calls context.makeelement and fleshes out the new element using properties
of the object or keyword arguments.

KML Placemark names derive from object 'title' properties or a 'name'   
argument. Snippets derive from object 'summary' properties or a 'snippet' 
argument. Descriptions derive from object 'content' properties or a 
'description' argument.(more...)

        def element(context, ob, **kw):
    """Make a KML element from an object that provides the Python geo   
    interface.
    
    Calls context.makeelement and fleshes out the new element using properties
    of the object or keyword arguments.
    
    KML Placemark names derive from object 'title' properties or a 'name'   
    argument. Snippets derive from object 'summary' properties or a 'snippet' 
    argument. Descriptions derive from object 'content' properties or a 
    'description' argument.
    
    Example:
      
      >>> kml = ''
      >>> from xml.etree import ElementTree
      >>> tree = ElementTree.fromstring(kml)
      >>> doc = tree[0]
      >>> doc # doctest: +ELLIPSIS
      
    
    First, with a geometry:
      
      >>> from keytree.kml import element
      >>> from keytree.model import Geometry
      >>> g = Geometry('Point', (0.0, 0.0))
      >>> elem = element(doc, g)
      >>> import pprint
      >>> pprint.pprint((elem.tag, elem.text, list(elem))) # doctest: +ELLIPSIS
      ('{http://www.opengis.net/kml/2.2}Point',
       None,
       [])
    
    Placemark:
      
      >>> from keytree.model import Feature
      >>> f = Feature('1', geometry=g, title='Feature 1', summary='The first feature', content='Blah, blah, blah.')
      >>> elem = element(doc, f)
      >>> import pprint
      >>> pprint.pprint((elem.tag, elem.text, list(elem))) # doctest: +ELLIPSIS
      ('{http://www.opengis.net/kml/2.2}Placemark',
       None,
       [,
        ,
        ,
        ])
      >>> pprint.pprint(list((e.tag, e.text, list(e)) for e in elem)) # doctest: +ELLIPSIS
      [('{http://www.opengis.net/kml/2.2}name', 'Feature 1', []),
       ('{http://www.opengis.net/kml/2.2}Snippet', 'The first feature', []),
       ('{http://www.opengis.net/kml/2.2}description', 'Blah, blah, blah.', []),
       ('{http://www.opengis.net/kml/2.2}Point',
        None,
        [])]
    
    """
    ns = context.tag.split('}')[0][1:]
    geo = getattr(ob, '__geo_interface__') or ob
    if geo.has_key('id') or geo.has_key('geometry'): # is a feature
        elem = placemark_element(context, ns, geo, **kw)
    elif geo.has_key('type'): # is a geometry
        elem = geometry_element(context, ns, geo)
    return elem
        


src/k/e/keytree-0.2.1/keytree/__init__.py   keytree(Download)
#
from factory import feature, geometry
from kml import element
 

src/k/e/keytree-HEAD/keytree/__init__.py   keytree(Download)
#
from factory import feature, geometry
from kml import element