How to use the pykml.factory.KML_ElementMaker.tilt function in pykml

To help you get started, we’ve selected a few pykml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pykml / pykml / src / examples / KmlReference / animatedupdate_example.py View on Github external
KML.coordinates(170.1435558771009,-43.60505741890396,0)
      ),
      id="mountainpin1"
    ),
    GX.Tour(
      KML.name("Play me!"),
      GX.Playlist(
        GX.FlyTo(
          GX.duration(3),
          GX.flyToMode("bounce"),
          KML.Camera(
            KML.longitude(170.157),
            KML.latitude(-43.671),
            KML.altitude(9700),
            KML.heading(-6.333),
            KML.tilt(33.5),
          )
        ),
        GX.AnimatedUpdate(
          GX.duration(5),
          KML.Update(
            KML.targetHref(),
            KML.Change(
              KML.IconStyle(
                KML.scale(10.0),
                targetId="mystyle"
              )
            )
          )
        ),
        GX.Wait(
          GX.duration(5)
github clawpack / visclaw / src / python / visclaw / plotpages.py View on Github external
x2 = plotfigure.kml_xlimits[1]
            y1 = plotfigure.kml_ylimits[0]
            y2 = plotfigure.kml_ylimits[1]
            ulinit = np.array([plotfigure.kml_xlimits[0], plotfigure.kml_ylimits[1]])
            urinit = np.array([plotfigure.kml_xlimits[1], plotfigure.kml_ylimits[1]])
            lrinit = np.array([plotfigure.kml_xlimits[1], plotfigure.kml_ylimits[0]])

            R = 6371.0   # radius of earth
            domain_width = R*np.cos(abs(y1+y2)*np.pi/360.0)*(x2-x1)*np.pi/180.0
            dist_factor = 2  # factor by which height should exceed width
            initial_height = min([1000*dist_factor*domain_width,9656064.0])   # <= 6000 miles

            initial_view = KML.LookAt(
                KML.longitude((ulinit[0]+urinit[0])/2),
                KML.latitude((urinit[1]+lrinit[1])/2),
                KML.tilt(0),
                KML.range(initial_height))   # in meters?

            doc.Document.append(deepcopy(initial_view))

            # we found something;  any other figures will have to have
            # 'kml_use_for_initial_view' set to override this view.
            first_found = True

    # ------------------- Loop over figures ----------------------

    fig_folder = KML.Folder(
        KML.name("Figures"),
        KML.open(1))

    for figname in plotdata._fignames:
github grst / geos / pykml_geos / helpers.py View on Github external
replace_delimited_string_member(
                    delimited_str=el.text,
                    separator=' ',
                    index_no=index_no,
                    decimal_places=max_decimals[data_type]
                )
            )
    
    if max_decimals.has_key('heading'):
        for el in doc.findall(".//{http://www.opengis.net/kml/2.2}heading"):
            new_val = round(float(el.text), max_decimals['heading'])
            el.getparent().heading = K.heading(new_val)
    if max_decimals.has_key('tilt'):
        for el in doc.findall(".//{http://www.opengis.net/kml/2.2}tilt"):
            new_val = round(float(el.text), max_decimals['tilt'])
            el.getparent().tilt = K.tilt(new_val)
    if max_decimals.has_key('range'):
        for el in doc.findall(".//{http://www.opengis.net/kml/2.2}range"):
            new_val = round(float(el.text), max_decimals['range'])
            el.getparent().range = K.range(new_val)
github pykml / pykml / src / examples / Tours / circle_around_landmarks.py View on Github external
KML.range(10000000.0),
          KML.altitudeMode("relativeToGround"),
        )
      ),
    )
    # fly to the feature
    tour_doc.Document[gxns+"Tour"].Playlist.append(
      GX.FlyTo(
        GX.duration(5),
        GX.flyToMode("bounce"),
        KML.LookAt(
          KML.longitude(feature['lon']),
          KML.latitude(feature['lat']),
          KML.altitude(0),
          KML.heading(0),
          KML.tilt(feature['tilt']),
          KML.range(feature['range']),
          KML.altitudeMode("relativeToGround"),
        )
      ),
    )
    # spin around the feature
    for aspect in range(0,360,10):
        tour_doc.Document[gxns+"Tour"].Playlist.append(
          GX.FlyTo(
            GX.duration(0.25),
            GX.flyToMode("smooth"),
            KML.LookAt(
              KML.longitude(feature['lon']),
              KML.latitude(feature['lat']),
              KML.altitude(0),
              KML.heading(aspect),
github pykml / pykml / src / examples / Tours / example_spline_camera.py View on Github external
def create_flyto_camera(location):
    
    flyto = GX.FlyTo(
        GX.duration(0.5),
        GX.flyToMode('smooth'),
    )
    flyto.append(
        KML.Camera(
            KML.longitude(location['loc'].longitude),
            KML.latitude(location['loc'].latitude),
            KML.altitude(location['loc'].altitude),
            KML.heading(location['loc'].heading),
            KML.tilt(location['loc'].tilt),
            KML.roll(location['loc'].roll),
            KML.altitudeMode('relativeToGround'),
        )
    )
    return flyto
github pykml / pykml / src / examples / KmlReference / altitudemode_reference.py View on Github external
http://code.google.com/apis/kml/documentation/kmlfiles/altitudemode_reference.kml
'''

from lxml import etree
from pykml.parser import Schema
from pykml.factory import KML_ElementMaker as KML
from pykml.factory import GX_ElementMaker as GX

doc = KML.kml(
    KML.Placemark(
        KML.name("gx:altitudeMode Example"),
        KML.LookAt(
            KML.longitude(146.806),
            KML.latitude(12.219),
            KML.heading(-60),
            KML.tilt(70),
            KML.range(6300),
            GX.altitudeMode("relativeToSeaFloor"),
        ),
        KML.LineString(
            KML.extrude(1),
            GX.altitudeMode("relativeToSeaFloor"),
            KML.coordinates(
              "146.825,12.233,400 "
              "146.820,12.222,400 "
              "146.812,12.212,400 "
              "146.796,12.209,400 "
              "146.788,12.205,400"
            )
        )
    )
)
github pykml / pykml / src / examples / Tours / example_spline_camera.py View on Github external
alt=location['loc'].altitude,
                head=location['loc'].heading,
                tilt=location['loc'].tilt,
                roll=location['loc'].roll,
            )
        ),
        KML.Model(
            KML.altitudeMode('relativeToGround'),
            KML.Location(
              KML.latitude(location['loc'].latitude),
              KML.longitude(location['loc'].longitude),
              KML.altitude(location['loc'].altitude),
            ),
            KML.Orientation(
              KML.heading(location['loc'].heading),
              KML.tilt(-location['loc'].tilt),
              KML.roll(location['loc'].roll),
            ),
            KML.Scale(
              KML.x(10),
              KML.y(10),
              KML.z(-10),
            ),
            KML.Link(
              KML.href('models/three_unit_lines.dae'),
            )
        )
    )
    return pm
github pykml / pykml / src / examples / misc / base_jump / virtual_base_jump.py View on Github external
alt=loc0['altitude'] + vz*t + 0.5*g*t**2,
            )),
            
        )
    )
    tour_doc.Folder.append(pm)
    
    flyto = gx.FlyTo(
        gx.duration(tstep),
        gx.flyToMode("smooth"),
        kml.Camera(
          kml.longitude(loc0['longitude'] + vx*t),
          kml.latitude(loc0['latitude'] + vy*t),
          kml.altitude(loc0['altitude'] + vz*t + 0.5*g*t**2),
          kml.heading(loc0['heading'] + vh*t),
          kml.tilt(loc0['tilt'] + vt*t),
          kml.altitudeMode("absolute"),
        )
    )
    tour_doc.Folder[GX_ns+"Tour"].Playlist.append(flyto)
    

assert Schema('kml22gx.xsd').validate(tour_doc)
print etree.tostring(tour_doc, pretty_print=True)

# output a KML file (named based on the Python script)
outfile = file(__file__.rstrip('.py')+'.kml','w')
outfile.write(etree.tostring(tour_doc, pretty_print=True))