How to use the pykml.factory.GX_ElementMaker 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 / Tours / circle_around_landmarks.py View on Github external
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),
              KML.tilt(feature['tilt']),
              KML.range(feature['range']),
              KML.altitudeMode("relativeToGround"),
            )
          )
        )
    tour_doc.Document[gxns+"Tour"].Playlist.append(GX.Wait(GX.duration(1.0)))
    
#    tour_doc.Document[gxns+"Tour"].Playlist.append(
#        GX.TourControl(GX.playMode("pause"))
#    )
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 / misc / base_jump / virtual_base_jump.py View on Github external
deltat = 30  # set manually, not sure what is wrong with the previous eqn

#import ipdb; ipdb.set_trace()

# calculate the horizontal and rotational velocities
vy = (loc1['latitude'] - loc0['latitude']) / deltat
vx = (loc1['longitude'] - loc0['longitude']) / deltat
vh = (loc1['heading'] - loc0['heading']) / deltat
vt = (loc1['tilt'] - loc0['tilt']) / deltat

# create a tour object
tour_doc = kml.kml(
    kml.Folder(
        gx.Tour(
          kml.name("Play me!"),
          gx.Playlist(),
        )
    )
)

tstep = 0.1
for t in drange(0,15,tstep):
    pm = kml.Placemark(
        kml.name(str(t)),
        kml.Point(
            kml.altitudeMode("absolute"),
            kml.coordinates("{lon},{lat},{alt}".format(
                lon=loc0['longitude'] + vx*t,
                lat=loc0['latitude'] + vy*t,
                alt=loc0['altitude'] + vz*t + 0.5*g*t**2,
            )),
github pykml / pykml / src / examples / Tours / circle_around_landmarks.py View on Github external
},
    {
        'name':"Racetrack Playa",
        'desc':'Death Valley, California, USA',
        'lon':-117.56, 'lat':36.679, 'tilt':45, 'range':8000
    },
    {
        'name':"Matterhorn",
        'desc':'Pennine Alps, Switzerland/Italy',
        'lon':7.6584, 'lat':45.9766, 'tilt':60, 'range':6000,
    },
]
# start with a base KML tour and playlist
tour_doc = KML.kml(
    KML.Document(
      GX.Tour(
        KML.name("Play me!"),
        GX.Playlist(),
      ),
      KML.Folder(
        KML.name('Features'),
        id='features',
      ),
    )
)
for feature in feature_list:
    #import ipdb; ipdb.set_trace()
    # fly to a space viewpoint
    tour_doc.Document[gxns+"Tour"].Playlist.append(
      GX.FlyTo(
        GX.duration(5),
        GX.flyToMode("smooth"),
github pykml / pykml / src / examples / Tours / circle_around_landmarks.py View on Github external
'name':"Racetrack Playa",
        'desc':'Death Valley, California, USA',
        'lon':-117.56, 'lat':36.679, 'tilt':45, 'range':8000
    },
    {
        'name':"Matterhorn",
        'desc':'Pennine Alps, Switzerland/Italy',
        'lon':7.6584, 'lat':45.9766, 'tilt':60, 'range':6000,
    },
]
# start with a base KML tour and playlist
tour_doc = KML.kml(
    KML.Document(
      GX.Tour(
        KML.name("Play me!"),
        GX.Playlist(),
      ),
      KML.Folder(
        KML.name('Features'),
        id='features',
      ),
    )
)
for feature in feature_list:
    #import ipdb; ipdb.set_trace()
    # fly to a space viewpoint
    tour_doc.Document[gxns+"Tour"].Playlist.append(
      GX.FlyTo(
        GX.duration(5),
        GX.flyToMode("smooth"),
        KML.LookAt(
          KML.longitude(feature['lon']),
github pykml / pykml / src / examples / Tours / example_spline_camera.py View on Github external
fld1 = KML.Folder(KML.name('original'))
    for loc in known_positions:
        fld1.append(create_placemarks(loc))
    
    # create a folder of interpolated placemarks
    fld2 = KML.Folder(KML.name('interpolated'))
    for loc in interp_positions:
        fld2.append(create_placemarks(loc))
    
    # create a folder of models showing camera positions/orientations
    fld3 = KML.Folder(KML.name('cameras'))
    for loc in interp_positions:
        fld3.append(create_camera_model_placemark(loc))
    
    # create a tour of camera positions
    playlist = GX.Playlist()
    for loc in interp_positions:
        playlist.append(create_flyto_camera(loc))
    
    fld = KML.Folder(
        fld1,
        fld2,
        fld3,
        GX.Tour(playlist),
    )
    
    print etree.tostring(fld, pretty_print=True)
github pykml / pykml / src / examples / KmlReference / animatedupdate_example.py View on Github external
id="mystyle"
      ),
      id="pushpin"
    ),
    KML.Placemark(
      KML.name("Pin on a mountaintop"),
      KML.styleUrl("#pushpin"),
      KML.Point(
        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(
github pykml / pykml / src / examples / misc / base_jump / virtual_base_jump.py View on Github external
z1 = loc1['altitude']
deltat = (-vz - math.sqrt(vz**2 - 2*g*(z0-z1))) / g
deltat = 30  # set manually, not sure what is wrong with the previous eqn

#import ipdb; ipdb.set_trace()

# calculate the horizontal and rotational velocities
vy = (loc1['latitude'] - loc0['latitude']) / deltat
vx = (loc1['longitude'] - loc0['longitude']) / deltat
vh = (loc1['heading'] - loc0['heading']) / deltat
vt = (loc1['tilt'] - loc0['tilt']) / deltat

# create a tour object
tour_doc = kml.kml(
    kml.Folder(
        gx.Tour(
          kml.name("Play me!"),
          gx.Playlist(),
        )
    )
)

tstep = 0.1
for t in drange(0,15,tstep):
    pm = kml.Placemark(
        kml.name(str(t)),
        kml.Point(
            kml.altitudeMode("absolute"),
            kml.coordinates("{lon},{lat},{alt}".format(
                lon=loc0['longitude'] + vx*t,
                lat=loc0['latitude'] + vy*t,
                alt=loc0['altitude'] + vz*t + 0.5*g*t**2,
github pykml / pykml / src / examples / Tours / example_spline_camera.py View on Github external
# create a folder of models showing camera positions/orientations
    fld3 = KML.Folder(KML.name('cameras'))
    for loc in interp_positions:
        fld3.append(create_camera_model_placemark(loc))
    
    # create a tour of camera positions
    playlist = GX.Playlist()
    for loc in interp_positions:
        playlist.append(create_flyto_camera(loc))
    
    fld = KML.Folder(
        fld1,
        fld2,
        fld3,
        GX.Tour(playlist),
    )
    
    print etree.tostring(fld, pretty_print=True)