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


Python KML_ElementMaker.scale方法代码示例

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


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

示例1: create_kml_from_waypoint

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
def create_kml_from_waypoint(waypoint):
    coordinates = "%s,%s" % (waypoint.long, waypoint.lat)
    doc = KML.kml(
        KML.Document(
            KML.Placemark(
                KML.name(waypoint.name),
                KML.description(waypoint.description if waypoint.description else ""),
                KML.Style(
                    KML.IconStyle(
                        KML.color("ffffffff"),
                        KML.scale(1.0),
                        KML.Icon(
                            KML.href("http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png")
                        ),
                    ),
                    KML.LabelStyle(
                        KML.scale(0.0)
                    )
                ),
                KML.Point(
                    KML.coordinates(coordinates)
                )
            )
        )
    )
    return doc
开发者ID:lbosson,项目名称:geoblogger,代码行数:28,代码来源:kml_helpers.py

示例2: newKML

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
def newKML():
    doc = KML.Document() 
    
    jet = plt.get_cmap('jet')
    
    colorList = {}
    for k in range(11):
        colorList[k] = matplotlib.colors.rgb2hex(jet(k/10.0))[1:]
    
    for (colorName, colorCode) in colorList.iteritems():
        style = KML.Style(
                    KML.IconStyle(
                        KML.color("FF{}".format(colorCode)),
                        KML.scale(0.6)
                    ),
                    KML.LabelStyle(KML.scale(0.5)),
                    id="house_{}".format(colorName)
                )
        styleMap = KML.StyleMap(
                    KML.Pair(
                        KML.key("normal"),
                        KML.styleUrl("house_{}".format(colorName))
                    ),
                    id="stylemap_house_{}".format(colorName))
                
        doc.append(style)
        doc.append(styleMap)    
    return doc
开发者ID:jyskwong,项目名称:houses,代码行数:30,代码来源:kmllib.py

示例3: kmlpush

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
def kmlpush(pt,label,stylename="sn_shaded_dot"):
	global kmloutput,outkml
	from pykml.factory import KML_ElementMaker as KML
	if kmloutput is None:
		kmloutput = KML.kml(
		    KML.Document(
		        KML.Name("Sun Position"),
		        KML.Style(
			      KML.IconStyle(
			        KML.scale(1.0),
			        KML.Icon(
			          KML.href("http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png"),
			        ),
			        id="mystyle"
			      ),
			      id="pushpin"
			    ),
		        KML.Style(
			      KML.IconStyle(
			        KML.scale(1.0),
			        KML.Icon(
			          KML.href("http://maps.google.com/mapfiles/kml/pushpin/red-pushpin.png"),
			        ),
			        id="redmystyle"
			      ),
			      id="redpushpin"
			    ),
		        KML.Style(
		            KML.IconStyle(
		                KML.scale(1.2),
		                KML.Icon(
		                    KML.href("http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png")
		                ),
		            ),
		            id="sn_shaded_dot",
		        )
		    )
		)
	if pt is None:
		from lxml import etree
		open(outkml,"wb").write(etree.tostring(kmloutput, pretty_print=True))
		return
	pt = KML.Placemark(
	    KML.name(label),
	    KML.styleUrl('#{0}'.format(stylename)),
	    KML.Point(
	        KML.extrude(True),
	        KML.altitudeMode('relativeToGround'),
	        KML.coordinates("{0},{1}".format(pt.lon.value,pt.lat.value)),
	    ),
	)
	kmloutput.Document.append(pt)
开发者ID:eruffaldi,项目名称:directionpole,代码行数:54,代码来源:locpole.py

示例4: add_style

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
def add_style(doc, color, highlight):

    # Add the normal style for the KML
    doc.append(KML.Style(
        KML.IconStyle(
            KML.color(color),
            KML.scale(1.1),
            KML.Icon(
                KML.href('http://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png')
            ),
            KML.hotspot('', x='16', y='31', xunits='pixels', yunits='insetPixels'),
        ),

        KML.LabelStyle(
            KML.scale(1.1)
        ),

        id='icon-503-{}-normal'.format(color)))

    # Add the highlight style for the KML
    doc.append(KML.Style(
        KML.IconStyle(
            KML.color(highlight),
            KML.scale(1.1),
            KML.Icon(
                KML.href('http://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png')
            ),
            KML.hotSpot('', x='16', y='31', xunits='pixels', yunits='insetPixels'),
        ),

        KML.LabelStyle(
            KML.scale(1.1)
        ),

        id='icon-503-{}-highlight'.format(highlight)))

    # Set the style map
    doc.append(KML.StyleMap(
        KML.Pair(
            KML.key('normal'),
            KML.styleUrl('#icon-503-{}-normal'.format(color))
        ),

        KML.Pair(
            KML.key('highlight'),
            KML.styleUrl('#icon-503-{}-highlight'.format(highlight))
        ),

        id='icon-503-{}'.format(color)))

    return doc
开发者ID:mlockwood,项目名称:go_transit_src,代码行数:53,代码来源:stop_kml.py

示例5: create_kml_placemarks_for_tracks_and_waypoints

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
def create_kml_placemarks_for_tracks_and_waypoints(tracks, waypoints, sample=1, description=None, color=None, name=None):
    placemarks = []
    tracks = tracks or []
    waypoints = waypoints or []

    for track in tracks:
        coordinates = ["%s,%s" % (p.longitude, p.latitude) for i, p in enumerate(track.points) if
                       i % sample == 0 or len(track.points) < 100]
        placemarks.append(
            KML.Placemark(
                KML.name(name or track.name),
                KML.description(description or track.description or ""),
                KML.Style(
                    KML.LineStyle(
                        KML.color(color) if color else get_random_color(),
                        KML.width(3)
                    )
                ),
                KML.MultiGeometry(
                    KML.LineString(
                        KML.coordinates(" ".join(coordinates))
                    )
                )
            )
        )

    for waypoint in waypoints:
        coordinates = "%s,%s" % (waypoint.long, waypoint.lat)
        placemarks.append(
            KML.Placemark(
                KML.name(name or waypoint.name),
                KML.description(description or waypoint.description or ""),
                KML.Style(
                    KML.IconStyle(
                        KML.color("ffffffff"),
                        KML.scale(1.0),
                        KML.Icon(
                            KML.href(
                                "http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png")
                        ),
                    ),
                    KML.LabelStyle(
                        KML.scale(0.0)
                    )
                ),
                KML.Point(
                    KML.coordinates(coordinates)
                )
            )
        )
    return placemarks
开发者ID:lbosson,项目名称:geoblogger,代码行数:53,代码来源:kml_helpers.py

示例6: create_reference_point_element

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
def create_reference_point_element(inps, lats, lons, ts_obj):

    star_file = "star.png"

    colormap = mpl.cm.get_cmap(inps.colormap)  # set colormap
    norm = mpl.colors.Normalize(vmin=inps.vlim[0], vmax=inps.vlim[1])

    ref_yx = (int(ts_obj.metadata['REF_Y']), int(ts_obj.metadata['REF_X']))
    ref_lalo = (lats[ref_yx[0], ref_yx[1]], lons[ref_yx[0], ref_yx[1]])

    reference_point = KML.Placemark(
        KML.Style(
            KML.IconStyle(
                KML.color(get_color_for_velocity(0.0, colormap, norm)),
                KML.scale(1.),
                KML.Icon(KML.href("{}".format(star_file)))
            )
        ),
        KML.description("Reference point <br /> \n <br /> \n" +
                        generate_description_string(ref_lalo, ref_yx, 0.00, 0.00, 0.00, 1.00)
                        ),
        KML.Point(
            KML.coordinates("{}, {}".format(ref_lalo[1], ref_lalo[0]))
        )
    )

    return reference_point, star_file
开发者ID:hfattahi,项目名称:PySAR,代码行数:29,代码来源:save_kmz_timeseries.py

示例7: initDocument

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
def initDocument():
	doc = KML.kml(
		KML.Document(
			KML.Name("Sun Position"),
			KML.Style(
				KML.IconStyle(
					KML.scale(1.2),
					KML.Icon(
						KML.href("http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png")
					),
				),
				id="truc"
			),
			KML.Style(
				KML.LineStyle(
					KML.color("ff0000ff"),
					KML.width(1)
				),
				KML.PolyStyle(
					KML.color("ffff0000")
				),
				id="redLineBluePoly"
			)
		)
	)
	return doc
开发者ID:will421,项目名称:PROJET_VM,代码行数:28,代码来源:kmlwriter.py

示例8: main

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
def main():
    kmlobj = KML.kml( KML.Document(KML.Style(KML.LabelStyle(KML.scale(6)),id="big_label")))
    data = '<?xml version="1.0" encoding="utf-8"?>\n<kml xmlns="http://www.opengis.net/kml/2.2">\n<Document>\n<name>Balloon with image</name>'
    cconn = CloudConn.CloudConn(mav_id)
    id = raw_input("flt_?")
    stat , vals = cconn.getallfromflt(int(id))
    counter = 0
    if stat == cons.SUCCESS:
        for each in vals:
            lat = float(each[0].split(",")[0].split("=")[1])
            lon = float(each[0].split(",")[1].split("=")[1])
            alt = float(each[0].split(",")[2].split("=")[1])
            kmlobj.Document.append(
            KML.Placemark(
                KML.name("ECE-445-DEMO"),
                KML.Point(
                    KML.extrude(1),
                    KML.altitudeMode('relativeToGround'),
                    KML.coordinates('{lon},{lat},{alt}'.format(
                            lon=lon,
                            lat=lat,
                            alt=alt,
                        ),
                    ))))
            #pm1 = KML.Placemark(KML.name(str(counter)),KML.Point(KML.coordinates(latlonstr)))
    dax = etree.tostring(etree.ElementTree(kmlobj),pretty_print=True)
    fd = open(fname+".kml", 'wb')
    fd.write(dax)
    fd.close()
开发者ID:andersonpaac,项目名称:ZipQuad,代码行数:31,代码来源:kmlparser.py

示例9: generateKML

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
def generateKML(ids, spotList):
    km = KML.kml()
    doc = KML.Document(KML.name("Aires camping car info"))
    icones = glob.glob(LOGOS_FOLDER+"A*")
    for icone in icones:
        icone = icone.replace(DESC_FOLDER, "")
        type = os.path.basename(icone).replace("40.gif", "")
        style = KML.Style(
          KML.IconStyle(
            KML.scale(1.0),
            KML.Icon(
              KML.href(icone),
            ),
          ),
          id=type.lower()
        )
        doc.append(style)
    for id in ids:
        idStr = str(id)
        with codecs.open(DESC_FOLDER+"/"+idStr+".html",'r',encoding='utf-8') as f:
            place = KML.Placemark(
                    KML.name(spotList[id]["name"]),
                    KML.description(f.read()),
                    KML.styleUrl("#"+spotList[id]["type"].lower()),
                    KML.Point(
                        KML.coordinates(spotList[id]["lat"]+","+spotList[id]["long"])
                        )
                    )
            doc.append(place)
    km.append(doc)
    print(etree.tostring(km))
开发者ID:nleleu,项目名称:ccinfo,代码行数:33,代码来源:ccinfo.py

示例10: generate_kml

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
def generate_kml(places):
	doc = KML.kml(
	    KML.Document(
	        KML.Name("Awesome places"),
	        KML.Style(
	            KML.IconStyle(
	                KML.scale(1.2),
	                KML.Icon(
	                    KML.href("http://maps.google.com/mapfiles/kml/pal4/icon28.png")
	                ),
	            )
	        )
	    )
	)

	for data in places:
		pm = KML.Placemark(
   			KML.name(data.get("name")),
   			KML.Point(KML.coordinates(str(data.get("lng")) + "," + str(data.get("lat"))))
  		)
  		doc.Document.append(pm)

	result = etree.tostring(doc, pretty_print=True)
	result.replace("placemark", "Placemark")
	result.replace("point", "Point")

	return result
开发者ID:KevinBrown,项目名称:GoogleEarthVisualizations,代码行数:29,代码来源:cl_generate.py

示例11: kml

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
def kml(locations):
    """KML file for the locations
    """
    # create document
    document = KML.kml(KML.Document(KML.name("Layer example")))
    # bullets
    for layer_code,layer_name in categories(locations):
        style = KML.Style(
            KML.IconStyle(
                KML.scale(1.0),
                KML.Icon(
                    KML.href('%slocations/%s.png' % (settings.MEDIA_URL, layer_code)),
                ),
                id='icon-%s' % layer_code
            ),
            id=layer_code
        )
        document.append(style)
    # locations
    folder = KML.Folder()
    for location in locations:
        placemark = KML.Placemark(
            KML.name(location['title']),
            KML.description('<![CDATA[ %s ]]>' % location['description']),
            KML.styleUrl('#%s' % location['category']),
            KML.Point(
                KML.coordinates(','.join([location['lng'],location['lat']]))
                ),
            )
        folder.append(placemark)
    document.append(folder)
    # rettsugo!
    return etree.tostring(document)
开发者ID:,项目名称:,代码行数:35,代码来源:

示例12: __init__

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
    def __init__(self, poseTopicName, utmZoneNumber):
        rospy.loginfo("[KMLTourGenerator] init()")
        self.prevLinVel = 0.0
        self.prevAngVel = 0.0

        self.hasFinished = False

        self.hasOdom = False
        self.currOdom = None
        self.prevOdom = None
        self.subPose = rospy.Subscriber(poseTopicName, Odometry, self.poseHandler)

        self.utmZoneNumber = utmZoneNumber
        self.utmZoneLetter = 'U'
        self.zOffset = 2.0

        self.planCoordListStr = ''
        self.execCoordListStr = ''
        
        self.totalTime = 0.0
        
        # define a variable for the Google Extensions namespace URL string
        self.gxns = '{' + nsmap['gx'] + '}'

        # start with a base KML tour and playlist

        self.anim_fld = KML.Folder(
                    KML.name('Animations'),
                    id='animations',
                )
        
        self.path_fld = KML.Folder(
                    KML.name('Paths'),
                    id='paths',
                )

        self.tour_doc = KML.kml(
            KML.Document(
                KML.Style(
                    KML.IconStyle(
                        KML.scale(1.2),
                        KML.Icon(
                            KML.href("http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png")
                        ),
                    ),
                    id='sn_shaded_dot',
                ),
                GX.Tour(
                    KML.name("Play me!"),
                    GX.Playlist(),
                ),
                self.anim_fld,
                self.path_fld
            )
        )
开发者ID:silviomaeta,项目名称:kml_util,代码行数:57,代码来源:generate_kml.py

示例13: create_style

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
 def create_style(id_, color, width, scale, icon):
   style = KML.Style(id=id_)
   if scale is not None:
     icon_style = KML.IconStyle(KML.scale(scale))
     if icon is not None:
       icon_style.append(KML.Icon(KML.href(icon)))
     style.append(icon_style)
   if (color is not None) and (width is not None):
     line_style = KML.LineStyle(KML.color(color), KML.width(width))
     style.append(line_style)
   return KmlStyle(id_, [style])
开发者ID:IoannisIn,项目名称:cellbots,代码行数:13,代码来源:earth.py

示例14: buildKML

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
def buildKML():
   media_filtered = pickle.load( open( "media_filtered.p", "rb" ) )
   
   kml = open('media_KML.kml', "w")
   kmlobj = KML.kml(
       KML.Document(
           KML.Style(
               KML.BalloonStyle(
                   KML.displayMode('default'),
                   KML.text('<b>$[name]</b><br/>$[description]')
               ),
               KML.IconStyle(
                  KML.Icon(
                     KML.href('http://maps.google.com/mapfiles/kml/paddle/red-circle.png'),
                     KML.scale('1.0')
                  ),
                  id='mystyle'
               ),
               id="balloonStyle"
           )
       )
   )

   # add placemarks to the Document element
   for media in media_filtered:
      kmlobj.Document.append(
            KML.Placemark(
               KML.name(media.location.name),
               KML.description("Name: " + media.user.full_name + 
                               "<br>Username: <a href=\"https://instagram.com/" + media.user.username + "/\">" + media.user.username + "</a><br>" +
                               "<img src=" + media.images['standard_resolution'].url + "><br>" +
                               media.caption.text),
               KML.styleUrl('#balloonStyle'),
               KML.TimeStamp(
                  KML.when(media.created_time.isoformat() + 'Z')
               ),
               KML.Point(
                  KML.extrude(1),
                  KML.altitudeMode('relativeToGround'),
                  KML.coordinates('{lon},{lat},{alt}'.format(
                      lon=media.location.point.longitude,
                      lat=media.location.point.latitude,
                      alt=0,
               ),
            ),
         ),
      )
   )
   kml.write(etree.tostring(etree.ElementTree(kmlobj),pretty_print=True))
   kml.close()
开发者ID:pyropenguin,项目名称:MigrantInstagram,代码行数:52,代码来源:GetTaggedImages.py

示例15: get_csv_doc

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import scale [as 别名]
def get_csv_doc(csv_path, index_name=None, index_lat=None, index_long=None,
                altitude=0):
    index_name = index_name or CSV_INDEX_NAME
    index_lat = index_lat or CSV_INDEX_LAT
    index_long = index_long or CSV_INDEX_LONG

    print "Indexes: {n}, {l}, {L}".format(
        n=index_name,
        l=index_lat,
        L=index_long
    )
    print "Reading from '{c}'".format(c=csv_path)

    doc = KML.kml(
        KML.name("Property List"),
        etree.Comment(get_comment(csv_path)),
        KML.Style(
            KML.IconStyle(
                KML.scale(1.0),
                KML.Icon(
                    KML.href("http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png"),
                ),
                id="mystyle"
            ),
            id="pushpin"
        ),
    )

    with open(csv_path, 'r') as csvin:
        reader = csv.reader(csvin)
        for row in reader:
            print "'{}' @ ({}, {})".format(
                row[index_name],
                row[index_lat],
                row[index_long]
            )

            doc.append(KML.Placemark(
                KML.name(row[index_name]),
                KML.Point(
                    KML.altitudeMode('relativeToGround'),
                    KML.styleUrl("#pushpin"),
                    KML.coordinates("{},{},{}".format(
                        row[index_long],row[index_lat], altitude
                    ))
                )
            ))

    return doc
开发者ID:tomislacker,项目名称:csv2kml,代码行数:51,代码来源:csv2kml.py


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