当前位置: 首页>>代码示例>>Python>>正文


Python KML_ElementMaker.heading方法代码示例

本文整理汇总了Python中pykml.factory.KML_ElementMaker.heading方法的典型用法代码示例。如果您正苦于以下问题:Python KML_ElementMaker.heading方法的具体用法?Python KML_ElementMaker.heading怎么用?Python KML_ElementMaker.heading使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pykml.factory.KML_ElementMaker的用法示例。


在下文中一共展示了KML_ElementMaker.heading方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: kml_addPathPoint

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
 def kml_addPathPoint(self, pos, dt):
     #pos[0] : latitude
     #pos[1] : longitude
     #pos[2] : altitude
     #pos[3] : roll
     #pos[4] : pitch
     #pos[5] : yaw
     if (pos == None):
         return
     #rospy.logerr(pos)
     
     self.tour_doc.Document[self.gxns+"Tour"].Playlist.append(
         GX.FlyTo(
             GX.duration(dt),
             GX.flyToMode("smooth"),
             #KML.Camera(
             KML.LookAt(
                 KML.latitude(pos[0]),
                 KML.longitude(pos[1]),
                 KML.altitude(pos[2]),
                 KML.heading(pos[5]),
                 #KML.tilt(pos[4] + 90.0),
                 #KML.roll(pos[3]),
                 KML.tilt(pos[4] + 75.0),
                 KML.range(20.0),
                 KML.altitudeMode("absolute"),
             ),
         ),
     )
     
     auxStr = ' {lon},{lat},{alt}\n'.format(lon=pos[1], lat=pos[0], alt=pos[2])
     #rospy.logerr(auxStr)
     self.execCoordListStr = self.execCoordListStr + auxStr
开发者ID:silviomaeta,项目名称:kml_util,代码行数:35,代码来源:generate_kml.py

示例2: kml_addAnimPoint

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
 def kml_addAnimPoint(self, pos, tm):
     #pos[0] : latitude
     #pos[1] : longitude
     #pos[2] : altitude
     #pos[3] : roll
     #pos[4] : pitch
     #pos[5] : yaw
     if (pos == None):
         return
     
     localTimeStr = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.localtime(tm))
     #rospy.logerr(localTimeStr)
     self.anim_fld.append(KML.Placemark(
         KML.TimeStamp(
             KML.when(localTimeStr)
         ),
         KML.altitudeMode("absolute"),
         KML.styleUrl('#sn_shaded_dot'),
         KML.LookAt(
             KML.longitude(pos[1]),
             KML.latitude(pos[0]),
             KML.altitude(pos[2]),
             KML.heading(pos[5]),
             KML.tilt(0.0),
             KML.range(100.0),
             KML.altitudeMode("absolute"),
         ),
         KML.Point(
             KML.coordinates("{lon},{lat},{alt}".format(lon=pos[1], lat=pos[0], alt=pos[2]))
         )
     ))        
开发者ID:silviomaeta,项目名称:kml_util,代码行数:33,代码来源:generate_kml.py

示例3: build_test_kml

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
def build_test_kml():
    """build a simple KML file with a simple LineString, for testing purposes"""

    from pykml.factory import KML_ElementMaker as KML
    from pykml.factory import GX_ElementMaker as GX
    from lxml import etree
    from django.http import HttpResponse

    kml = KML.kml(
        KML.Placemark(
            KML.name("build_test_kml output"),
            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"
                ),
            ),
        )
    )
    kml_str = etree.tostring(kml)
    return HttpResponse(kml_str, content_type="application/vnd.google-earth.kml")
开发者ID:pombredanne,项目名称:lizard-kml,代码行数:36,代码来源:kml.py

示例4: test_basic_kml_document

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
    def test_basic_kml_document(self):
        """Tests the creation of a basic KML with Google Extensions ."""
        doc = KML.kml(
            GX.Tour(
                GX.Playlist(
                    GX.SoundCue(
                        KML.href('http://dev.keyhole.com/codesite/cntowerfacts.mp3')
                    ),
                    GX.Wait(
                        GX.duration(10)
                    ),
                    GX.FlyTo(
                        GX.duration(5),
                        GX.flyToMode('bounce'),
                        KML.LookAt(
                            KML.longitude(-79.387),
                            KML.latitude(43.643),
                            KML.altitude(0),
                            KML.heading(-172.3),
                            KML.tilt(10),
                            KML.range(1200),
                            KML.altitudeMode('relativeToGround'),
                        )
                    )
                )
            )
        )
        self.assertTrue(Schema('kml22gx.xsd').validate(doc))

        data = etree.tostring(doc, encoding='ascii')
        expected = \
            b'<kml xmlns:gx="http://www.google.com/kml/ext/2.2" ' \
            b'xmlns:atom="http://www.w3.org/2005/Atom" ' \
            b'xmlns="http://www.opengis.net/kml/2.2">' \
            b'<gx:Tour>' \
            b'<gx:Playlist>' \
            b'<gx:SoundCue>' \
            b'<href>http://dev.keyhole.com/codesite/cntowerfacts.mp3</href>' \
            b'</gx:SoundCue>' \
            b'<gx:Wait>' \
            b'<gx:duration>10</gx:duration>' \
            b'</gx:Wait>' \
            b'<gx:FlyTo>' \
            b'<gx:duration>5</gx:duration>' \
            b'<gx:flyToMode>bounce</gx:flyToMode>' \
            b'<LookAt>' \
            b'<longitude>-79.387</longitude>' \
            b'<latitude>43.643</latitude>' \
            b'<altitude>0</altitude>' \
            b'<heading>-172.3</heading>' \
            b'<tilt>10</tilt>' \
            b'<range>1200</range>' \
            b'<altitudeMode>relativeToGround</altitudeMode>' \
            b'</LookAt>' \
            b'</gx:FlyTo>' \
            b'</gx:Playlist>' \
            b'</gx:Tour>' \
            b'</kml>'

        self.assertXmlEquivalentOutputs(data, expected)
开发者ID:recombinant,项目名称:pykml,代码行数:62,代码来源:test_factory.py

示例5: get_kml_doc

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
def get_kml_doc(llhs):
  """Generates a KML document from a Pandas table of single point
  solutions. Requires columns lat, lon, and height.

  """
  from pykml.parser import Schema
  from pykml.factory import KML_ElementMaker as KML
  from pykml.factory import GX_ElementMaker as GX
  center = llhs[['lat', 'lon', 'height']].mean()
  elts = lambda e: '%s,%s,%d' % (e['lon'], e['lat'], e['height'])
  coords = ' '.join(llhs.apply(elts, axis=1).values)
  xml_coords = KML.coordinates(coords)
  doc = KML.kml(
          KML.Placemark(
            KML.name("gx:altitudeMode Example"),
            KML.LookAt(
              KML.longitude(center.lon),
              KML.latitude(center.lat),
              KML.heading(center.height),
              KML.tilt(70),
              KML.range(6300),
              GX.altitudeMode("relativeToSeaFloor"),),
            KML.LineString(
              KML.extrude(1),
              GX.altitudeMode("relativeToSeaFloor"),
              xml_coords
            )
          )
        )
  return doc
开发者ID:imh,项目名称:gnss-analysis,代码行数:32,代码来源:build_map.py

示例6: get_look_at

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
 def get_look_at(self):
   return \
     KML.LookAt(
       KML.longitude(self.camera[0]),
       KML.latitude(self.camera[1]),
       KML.altitude(self.camera[2]),
       KML.heading(self.camera[3]),
       KML.tilt(self.camera[4]),
       KML.range(self.camera[5]),
     )
开发者ID:IoannisIn,项目名称:cellbots,代码行数:12,代码来源:earth.py

示例7: task_to_kml_with_pykml

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
def task_to_kml_with_pykml(df_task, outdir, filename_base, disp):
    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

    s_coords = task_to_string(df_task)    
    (lat, lon) = calculate_center(df_task)
    
    #def turn_point_to_placemark(tp):
    #    placemark = KML.Placemark(
    #        KML.name(tp['Name']),
    #        KML.description(tp['Name']),
    #        KML.Point(
    #            KML.coordinates(tp['Lon'], tp['Lat'], tp['Altitude'])
    #        ),
    #    )
    #    return(placemark)
    #placemarks = [turn_point_to_placemark(tp) for i, tp in df_task.iterrows()]

    doc = KML.kml(
        KML.Placemark(
            KML.name("Condor task '%s'" % filename_base),
            KML.LookAt(
                KML.longitude(lon),
                KML.latitude(lat),
                KML.heading(0),
                KML.tilt(60),
                KML.range(80000),
                GX.altitudeMode("relativeToSeaFloor"),
                #GX.altitudeMode("absolute"),
            ),
            KML.LineString(
                KML.extrude(1),
                GX.altitudeMode("relativeToSeaFloor"),
                #GX.altitudeMode("absolute"),
                KML.coordinates(s_coords),
            ),
        ),
        #*placemarks
    )
    if disp:
        print(etree.tostring(doc, pretty_print=True))
    # output a KML file (named based on the Python script)
    filename_out = os.path.join(outdir, filename_base + '.kml')
    print("Output '%s'" % filename_out)
    outfile = file(filename_out,'w')
    outfile.write(etree.tostring(doc, pretty_print=True))

    assert Schema('kml22gx.xsd').validate(doc)
开发者ID:lordfolken,项目名称:pycondor,代码行数:52,代码来源:task.py

示例8: frame_placemark

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
def frame_placemark(origin, name, x, y, theta=0.0,
                    marker='axes.png', scale=1.0, color='ffffffff'):
    frame = srr.util.local_to_global(origin, x, y, theta)

    return KML.Placemark(
        KML.name(name),
        KML.Point(
            KML.coordinates("{lon},{lat},{alt}".format(
                lon=frame[0], lat=frame[1], alt=0)),
            ),
        KML.LookAt(
            KML.longitude(frame[0]),
            KML.latitude(frame[1]),
            KML.altitude(0),
            KML.heading(frame[2]),
            KML.tilt(0),
            KML.roll(0),
            KML.altitudeMode("relativeToGround"),
            KML.range(DEFAULT_HEIGHT)
        ),
        KML.Style(
            KML.IconStyle(
                KML.scale(scale),
                KML.heading(frame[2]),
                KML.color(color),
                KML.Icon(
                    KML.href(flask.url_for('static',
                                           filename=marker,
                                           _external=True)),
                    ),
                KML.hotSpot(x="0.5", y="0.5",
                            xunits="fraction",
                            yunits="fraction")
                ),
            )
        )
开发者ID:cephalsystems,项目名称:srr,代码行数:38,代码来源:viewer.py

示例9: create_flyto_camera

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
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
开发者ID:123abcde,项目名称:pykml,代码行数:20,代码来源:example_spline_camera.py

示例10: create_camera_model_placemark

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
def create_camera_model_placemark(location):
    
    pm = KML.Placemark(
        KML.description(
            '<table border="1">'
            '<tr><th>latitude</th><td>{lat}</td>'
            '<tr><th>longitude</th><td>{lon}</td>'
            '<tr><th>altitude</th><td>{alt}</td>'
            '<tr><th>heading</th><td>{head}</td>'
            '<tr><th>tilt</th><td>{tilt}</td>'
            '<tr><th>roll</th><td>{roll}</td>'
            '</table>'.format(
                lat=location['loc'].latitude,
                lon=location['loc'].longitude,
                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
开发者ID:123abcde,项目名称:pykml,代码行数:45,代码来源:example_spline_camera.py

示例11: point_placemark

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
def point_placemark(origin, name, x, y):
    point = srr.util.local_to_global(origin, x, y)

    return KML.Placemark(
        KML.name(name),
        KML.LookAt(
            KML.longitude(point[0]),
            KML.latitude(point[1]),
            KML.altitude(0),
            KML.heading(origin[2]),
            KML.tilt(0),
            KML.roll(0),
            KML.altitudeMode("relativeToGround"),
            KML.range(DEFAULT_HEIGHT)
        ),
        KML.Point(
            KML.coordinates("{lon},{lat},{alt}".format(
                lon=point[0], lat=point[1], alt=0)),
            )
        )
开发者ID:cephalsystems,项目名称:srr,代码行数:22,代码来源:viewer.py

示例12: str

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
from lxml import etree

URL = 'http://curiosityrover.com/drives'

route = json.loads( urllib2.urlopen(URL).read() )

pList = ''
for point in route:
    pList = pList + str(point['lon']) + ',' + str(point['lat']) +',1,'

pm = KML.Placemark(
    KML.name('Curiosity traversal'),
    KML.LookAt(
        KML.longitude(route[0]['lon']),
        KML.latitude(route[0]['lat']),
        KML.heading('0'),
        KML.tilt('40'),
        KML.range('2000'),
        GX.altitudeMode('relativeToSeaFloor'),
        ),
    KML.LineStyle(
        KML.color('#00FFFF'),
        KML.width(10)
    ),
    KML.altitudeMode('clampToGround'),
    KML.LineString(KML.extrude('1'), GX.altitudeMode('relativeToSeaFloor'), KML.coordinates(pList))
    )

folder = KML.Folder()
folder.append(pm)
开发者ID:bilthon,项目名称:MSLTracker,代码行数:32,代码来源:mslRoute.py

示例13: range

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
###############################################################################################################################
# create a document element with multiple label style
kmlobj = KML.kml(
    KML.Document(
    )
)  
 
for j in range(len(yyyy)):  #create the ref icons we will use
    kmlobj.Document.append(    
        KML.Style(            
            KML.IconStyle(
                KML.Icon(
                    KML.href('%s.png'%str(int(index[j]))),
                    KML.scale(0.6),   #scale the beachball in googleEarth
                ),
                KML.heading(0.0),
            ),
        id='EekMex_%i'%j    #gives the icon a ref that will be used later
        ),
    )
 
# add images to the document element
for i in range(len(yyyy)):
    datum = str(date.date(int(yyyy[i]),int(mm[i]),int(dd[i])))
    ev_time = str(date.time(int(hr[i]),int(mn[i]),int(ss[i])))
    alt = str(altitude[i])
    press = str(pressure[i])
    temp = str(temperature[i])
    imur = str(roll[i])
    imup = str(pitch[i])
    imuy = str(yaw[i])
开发者ID:xe1gyq,项目名称:EekMex,代码行数:33,代码来源:emgekml.py

示例14: create_kml_tour

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
def create_kml_tour(addresses, filename):
    '''
    Creates a kml tour of the sites
    Modified from pykml example here https://pythonhosted.org/pykml/examples/tour_examples.html
    python
    Generate a KML document of a tour based on rotating around locations.
    '''
    tilt = 20
    distance = 20

    # define a variable for the Google Extensions namespace URL string
    gxns = '{' + nsmap['gx'] + '}'

    # 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('Sites'),
            id='sites',
          ),
        )
    )

    for address in addresses:
        #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(address['longitude']),
              KML.latitude(address['latitude']),
              KML.altitude(0),
              KML.heading(0),
              KML.tilt(0),
              KML.range(10000000.0),
              KML.altitudeMode("relativeToGround"),
            )
          ),
        )
        # fly to the address
        tilt = tilt + 10
        distance = distance + 10
        tour_doc.Document[gxns+"Tour"].Playlist.append(
          GX.FlyTo(
            GX.duration(0.25),
            GX.flyToMode("smooth"),
            KML.LookAt(
              KML.longitude(address['longitude']),
              KML.latitude(address['latitude']),
              KML.altitude(0),
              KML.heading(0),
##              KML.tilt(address['tilt']),
##              KML.range(address['range']),
              KML.tilt(tilt),
              KML.range(distance),
              KML.altitudeMode("relativeToGround"),
            )
          ),
        )
        
        # add a placemark for the address
        tour_doc.Document.Folder.append(
          KML.Placemark(
            KML.name("?"),
            KML.description(
                "<h1>{name}</h1><br/>{desc}".format(
                        name=address['Site'],
                        desc=address['Bandwidth'],
                )
            ),
            KML.Point(
              KML.extrude(1),
              KML.altitudeMode("relativeToGround"),
              KML.coordinates("{lon},{lat},{alt}".format(
                      lon=address['longitude'],
                      lat=address['latitude'],
                      alt=50,
                  )
              )
            ),
            id=address['Site'].replace(' ','_')
          )
        )
        # show the placemark balloon
        tour_doc.Document[gxns+"Tour"].Playlist.append(
            GX.AnimatedUpdate(
              GX.duration(2.0),
              KML.Update(
                KML.targetHref(),
                KML.Change(
                  KML.Placemark(
                    KML.visibility(1),
                    GX.balloonVisibility(1),
                    targetId=address['Site'].replace(' ','_')
#.........这里部分代码省略.........
开发者ID:FranMcG,项目名称:mapper,代码行数:103,代码来源:mapper.py

示例15:

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import heading [as 别名]
http://code.google.com/apis/kml/documentation/kmlreference.html#gxaltitudemode
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"
            )
        )
开发者ID:123abcde,项目名称:pykml,代码行数:33,代码来源:altitudemode_reference.py


注:本文中的pykml.factory.KML_ElementMaker.heading方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。