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


Python KML_ElementMaker.latitude方法代码示例

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


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

示例1: build_test_kml

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import latitude [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

示例2: get_kml_doc

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import latitude [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

示例3: kml_addAnimPoint

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import latitude [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

示例4: kml_addPathPoint

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import latitude [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

示例5: test_basic_kml_document

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import latitude [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

示例6: get_look_at

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import latitude [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 latitude [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: createPlacemark

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import latitude [as 别名]
    def createPlacemark(self, uuid, filetoDAE, center):
        node_transformed = self.transformCoorindate(center)
        pm1 = KML.Placemark(
            KML.name(uuid),
            KML.Model(
                KML.styleUrl("#transYellowPoly"),
                KML.altitudeMode('relativeToGround'),
                KML.Location(
                    KML.longitude(node_transformed.getX()),
                    KML.latitude(node_transformed.getY()),
                ),
                KML.Link(
                    KML.href(filetoDAE),
                ),
            ),

        )
        return pm1
开发者ID:iut-ibk,项目名称:PowerVIBe,代码行数:20,代码来源:exportkml.py

示例9: create_flyto_camera

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import latitude [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: placeMaker

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import latitude [as 别名]
def placeMaker(attr):
    '''Uses pyKML to produce a placemark for an image
    
The use of pyKML isn't actually necessary,
you could do just as well appending the placemarks from the NASA
KML files into a single document, but the intention was to
give an example usage of pyKML.'''
    try:
        placemark = K.Placemark(
                        K.open(0),
                        K.name(attr['MRF']),
                        K.styleUrl("#sm_style"),
                        K.Point(
                            K.altitudeMode('relativeToGround'),
                            K.coordinates(",".join([attr["Longitude"],attr["Latitude"],attr["Elevation"]]))
                        ),
                        K.LookAt(
                            K.tilt(attr["Tilt"]),
                            K.longitude(attr["Longitude"]),
                            K.latitude(attr["Latitude"]),
                            K.range(40000)
                        ),
                        K.TimeStamp(K.when(time.strftime("%Y-%m-%dT%H:%M:%SZ",time.strptime(attr["YYYYMMDD"]+attr["HHMMSS"],"%Y%m%d %H%M%S")))),
                        K.ExtendedData(
                            K.Data( K.value(attr["MRF"]), name="MRF"),
                            K.Data( K.value(attr["IMG"]), name="IMG"),
                            K.Data( K.value(attr["Features"]), name="features"),
                            K.Data( K.value(attr["YYYYMMDD"]), name="YYYYMMDD"),
                            K.Data( K.value(attr["HHMMSS"]), name="HHMMSS"),
                            K.Data( K.value(attr["Camera Tilt"]), name="Camera_Tilt"),
                            K.Data( K.value(attr["Camera Lens"]), name="Camera_Lens"),
                            K.Data( K.value(attr["Camera"]), name="Camera"),
                            K.Data( K.value(attr["Sun Azimuth"]), name="Sun_Azimuth"),
                            K.Data( K.value(attr["Sun Elevation"]), name="Sun_Elevation"),
                            K.Data( K.value(attr["Spacecraft Altitude"]), name="Spacecraft_Altitude"),
                            K.Data( K.value(attr["DB Entry"]), name="DB_Entry"),
                        )

                        
                    )
    except :
        return None
    return placemark
开发者ID:rsawtell,项目名称:AstroKML,代码行数:45,代码来源:AstroKML.py

示例11: create_camera_model_placemark

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import latitude [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

示例12: point_placemark

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import latitude [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

示例13: make_kml

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import latitude [as 别名]
 def make_kml(self, lon, lat):
     """
     :return: write kml file from defined properties
     """
     doc = KML.kml(
     etree.Comment(' required when using gx-prefixed elements '),
     GX.FlyTo(
     GX.flyToMode('bounce'),
     GX.duration('0.5')
     ),
     KML.Placemark(
     KML.name('gx:altitudeMode Example'),
     KML.Camera(
       KML.altitude(self.vh),
       KML.longitude(str(lon)),
       KML.latitude(str(lat))
     ),
     ),
     )
     string = etree.tostring(etree.ElementTree(doc),pretty_print=True)
     #writeToFile
     f = open(self.outfile, 'w')
     f.writelines(string)
     f.close()
开发者ID:initze,项目名称:GE_game,代码行数:26,代码来源:ge_game.py

示例14: frame_placemark

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import latitude [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

示例15: str

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import latitude [as 别名]
from pykml.factory import GX_ElementMaker as GX
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,代码行数:33,代码来源:mslRoute.py


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