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


Python KML_ElementMaker.tessellate方法代码示例

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


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

示例1: finish

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import tessellate [as 别名]
    def finish(self, kmlFilename):
        rospy.loginfo("[KMLTourGenerator] finish()")
        if (self.hasFinished):
            return

        self.path_fld.append(KML.Placemark(
            KML.name('plan-path'),
            KML.extrude("1"),
            KML.tessellate("1"),
            KML.altitudeMode("absolute"),
            KML.Style(
                KML.LineStyle(
                    KML.color('7FFF0000'),
                    KML.width(5)
                ),
                KML.PolyStyle(
                    KML.color('7FFFFF00')
                )
            ),
            KML.LineString(
                KML.tessellate("1"),
                KML.altitudeMode("absolute"),
                KML.coordinates(self.planCoordListStr)
            )
        ))

        self.path_fld.append(KML.Placemark(
            KML.name('exec-path'),
            KML.altitudeMode("absolute"),
            KML.Style(
                KML.LineStyle(
                    KML.color('7F0000FF'),
                    KML.width(5)
                ),
                KML.PolyStyle(
                    KML.color('7FFFFFFF')
                )
            ),
            KML.LineString(
                KML.extrude("1"),
                KML.tessellate("1"),
                KML.altitudeMode("absolute"),
                KML.coordinates(self.execCoordListStr)
            )
        ))
        
        # check that the KML document is valid using the Google Extension XML Schema
        #assert(Schema("kml22gx.xsd").validate(self.tour_doc))

        #print etree.tostring(self.tour_doc, pretty_print=True)

        # output a KML file (named based on the Python script)
        outfile = file(kmlFilename,'w')
        outfile.write(etree.tostring(self.tour_doc, pretty_print=True))            
        self.hasFinished = True
开发者ID:silviomaeta,项目名称:kml_util,代码行数:57,代码来源:generate_kml.py

示例2: _convert_

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

#.........这里部分代码省略.........
                  '<div id="graphdiv"></div>'
                  '<script type="text/javascript">'
                         'g = new Dygraph('
                             'document.getElementById("graphdiv"),'
                             '$[csv_data],'
                             '{{'
                                 'ylabel: \'{param} [{units}]\','
                                 'legend: \'always\''
                             '}}'
                          ');'
                  '</script>').format(
                      param=meta.variable.name,
                      units=meta.variable.units,
                  ))
              ),
              id="style-highlight",
            ),
            #Time Folders will be appended here
          ),
        )
        try:
            s = db.Session()
            
            # create a folder to hold the geometries
            geom_fld = KML.Folder(
                KML.name('Geometries'),
            )
            
            for geom in s.query(db.Geometry).all():
                
                coord_list = geom.as_kml_coords()
                multigeom_args = [
                    KML.Polygon(
                      KML.tessellate('1'),
                      KML.outerBoundaryIs(
                        KML.LinearRing(
                          KML.coordinates(coords.text),
                        ),
                      ),
                    ) for coords in coord_list
                ]
                
                # TODO: sort values by time to speed loading
                values = ['{0},{1}'.format(datetime.strftime(val.time, "%Y-%m-%d %H:%M:%S"),val.value) for val in geom.values]
                pm = KML.Placemark(
                    KML.name('Geometry'),
                    
                    KML.ExtendedData(
                        KML.Data(
                            KML.value('"Date,{param}\\n{data}"'.format(
                                    param=meta.variable.name,
                                    data='\\n'.join(values))
                            ),
                            name="csv_data",
                        ),
                    ),
                    KML.description(''),
                    KML.styleUrl('#smap'),
                    KML.MultiGeometry(*multigeom_args),
                )
                geom_fld.append(pm)
            doc.Document.append(geom_fld)

#            for time in s.query(db.Time).all():
#                # create a folder for the time
#                timefld = KML.Folder(
开发者ID:LeadsPlus,项目名称:OpenClimateGIS,代码行数:70,代码来源:kml.py

示例3: section_to_kml

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import tessellate [as 别名]
def section_to_kml(section, color, outfile_path="", write=True):
        """
        Converts a section into a kml file
        """
        line_style_id = "line-%s-5" % color
        red = "FF1212"
        green = "00B80C"
        start_icon_style_id = "icon-%s" % color
        end_icon_style_id = "icon-%s" % color        
        make_coord = lambda p: (",".join(map(lambda x: str(x), 
                         p["track_location"]["coordinates"]) + ["0.0"]))
        make_coord_point = lambda p: (",".join(map(lambda x: str(x), 
                         p["coordinates"]) + ["0.0"]))
	style_id = "style-%s" % section['section_start_time']
        pm = KML.Placemark(
                KML.styleUrl("#%s" % line_style_id),
                KML.name(section['_id']),
		KML.description(section["section_id"]),
                KML.LineString(
                        KML.tessellate(1),                        
                        KML.coordinates(" ".join(
                                map(lambda track_point: make_coord(track_point)
                                    ,section['track_points'])))
                )
        )
        start_point = section['section_start_point']
        end_point = section['section_end_point']
        start_time = mongodate_to_datetime(section["section_start_time"])
        end_time = mongodate_to_datetime(section["section_end_time"])
        start_point = KML.Placemark(
                KML.styleUrl("#%s" % start_icon_style_id),                
                KML.name("Start: %s" % start_time),
                KML.description("Starting point"),
                KML.Point(KML.coordinates(make_coord_point(start_point)))
        )
        end_point = KML.Placemark(
                KML.styleUrl("#%s" % end_icon_style_id),
                KML.name("End: %s" % end_time),
                KML.description("Ending point"),
                KML.Point(KML.coordinates(make_coord_point(end_point)))
        )
        line_style = KML.Style(
                KML.LineStyle(
                        KML.color("ff%s" % color),
                        KML.width("5")
                )
        )
        line_style.set("id", line_style_id)
        start_icon_style = KML.Style(
                KML.IconStyle(
                        KML.color("ff%s" % color),
                        KML.scale("1.1"),
                        KML.Icon(
                                KML.href("http://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png")
                        )
                )
        )
        start_icon_style.set("id", start_icon_style_id)
        end_icon_style = KML.Style(
                KML.IconStyle(
                        KML.color("ff%s" % color),
                        KML.scale("1.1"),
                        KML.Icon(
                                KML.href("http://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png")
                        )                       
                )
        )
        end_icon_style.set("id", end_icon_style_id)
        fld = KML.Folder(
                KML.name(section['_id']),
                KML.description("From %s \nto %s" % (start_time, end_time)),
                pm,
                start_point,
                end_point
        )       
        if write:                
                kml = KML.kml(KML.Document(fld, section["user_id"]))
                path = os.path.join(outfile_path, str(section['user_id']) +'.kml')
                outfile = file(path,'w')
                outfile.write(etree.tostring(kml, pretty_print=True))
        else:
                return fld, line_style, start_icon_style, end_icon_style
开发者ID:adambrown13,项目名称:e-mission-server,代码行数:84,代码来源:util.py

示例4: convert_to_kml

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

#.........这里部分代码省略.........
			if history == "": history = "n/a"
		coords = record[6]
		addrss = record[7]
		if addrss is None:
			addrss = "n/a"
		else:
			addrss = convert_to_xmlvalid(addrss)
			if addrss == "": addrss = "n/a"
		
		print "Record: " + str(record[0])
		print "Name: " + str(name)
		print "Classification: " + str(classification)
		print "Dates: " + str(dates)
		print "Status: " + str(status)
		print "History: " + str(history)
		print "Coordinates: " + str(coords)
		print "1912 Address: " + str(addrss)
		print "\n"
		#answer = raw_input("Press enter to continue...")
		
		if classification == "residential":
			style_url = "#residential_map"
		elif classification == "hotel":
			style_url = "#hotel_map"
		elif classification == "commercial":
			style_url = "#comm_map"
		elif classification == "industrial":
			style_url = "#industrial_map"
		elif classification == "institute":
			style_url = "#institute_map"
		elif classification == "health":
			style_url = "#health_map"
		elif classification == "religious":
			style_url = "#relig_map"
		elif classification == "recreational":
			style_url = "#rec_map"
		elif classification == "transportation":
			style_url = "#trans_map"
			
		photo_html = get_photo_html(c, id_num)
		source_text = get_sources(c, id_num)
		
		print "name: " + str(name)
		
		out_doc.append(
			KML.Placemark(
				KML.name(name.encode('utf-8')),
				KML.styleUrl(style_url),
				KML.ExtendedData(
					KML.Data(
						KML.value(str(name)),
						name="name"
					), 
					KML.Data(
						KML.value(str(dates)),
						name="dates"
					), 
					KML.Data(
						KML.value(str(status)),
						name="status"
					), 
					KML.Data(
						KML.value(str(history)),
						name="history"
					), 
					KML.Data(
						KML.value(str(addrss)),
						name="addrss"
					), 
					KML.Data(
						KML.value(str(source_text)),
						name="sources"
					), 
					KML.Data(
						KML.value(str(photo_html)),
						name="photos"
					), 
					#KML.Data(value=str(status), name="status"), 
					#KML.Data(value=str(history), name="history"), 
					#KML.Data(value=str(photo_html), name="photos"), 
				),
				KML.Polygon(
					KML.tessellate("1"),
					KML.outerBoundaryIs(
						KML.LinearRing(
							KML.coordinates(coords),
						),
					),
				),
			),
		)
		
	out_kml.append(out_doc)
	
	kml_text = etree.tostring(out_kml, pretty_print=True)
	
	kml_fn = os.path.splitext(db_file)
	
	kml_file = open(kml_fn[0] + ".kml", 'w')
	kml_file.write(kml_text + "\n")
开发者ID:kballant,项目名称:My_Scripts,代码行数:104,代码来源:kml_editor.py

示例5: open

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import tessellate [as 别名]
                KML.name(str(idx)),
                KML.description(description),
                KML.Point(
                    KML.coordinates('%s, %s, %s' % (lon, lat, alt))
                    )
                )
        doc.append(pm)

        idx += 1

    # Create KML path
    pm_path = KML.Placemark(
                KML.styleUrl('#kml_style'),
                KML.name('Path'),
                KML.LineString(
                    KML.extrude('1'),
                    KML.tessellate('1'),
                    KML.altitudeMode('relative'),
                    KML.coordinates('\n'.join(path_data))
                    )
                )
    doc.append(pm_path)

    # Write KML object to file
    kml = KML.kml(doc)
    xml_str = etree.tostring(kml, pretty_print = True)
    outfp = open(path.splitext(args.source)[0] + '.kml', 'wt')
    outfp.write(xml_str)
    outfp.close()

开发者ID:cfezequiel,项目名称:geotools,代码行数:31,代码来源:genkml.py


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