zoukankan      html  css  js  c++  java
  • arcgis python 表属性转html

    import arcpy
    import sys
    import string
    import os
    
    tablePath = arcpy.GetParameterAsText(0)
    filePath = arcpy.GetParameterAsText(1)
    
    outfile = open(filePath, "w")
    fields = arcpy.ListFields(tablePath)
    
    fieldNames = []
    for field in fields:
        if (field.type <> "Geometry" and field.type <> "BLOB"):
            fieldNames.append(field.name)
    outfile.write("<table border=""1"">
    ")
    outfile.write("<tr>
    ")
    
    for fieldName in fieldNames:
        outfile.write("<th>" + fieldName + "</th>
    ")
    outfile.write("</tr>
    ")
    
    for row in arcpy.da.SearchCursor(tablePath, fieldNames):
        outfile.write("<tr>
    ")
        for value in row:
            outfile.write(u"<td>" + str(value) + "</td>
    ")
        outfile.write("</tr>
    ")
    outfile.write("</table>
    ")
    
    outfile.flush()
    outfile.close()
  • 相关阅读:
    2.25
    2.24
    2.22
    influxdb 配置
    mongodb 数据备份
    influxDb数据备份
    Linux 及 git 指令集合
    git 项目 保存至gitee中
    TypeScripte 资料
    SecureCrt 的配色方案
  • 原文地址:https://www.cnblogs.com/gisoracle/p/11396181.html
Copyright © 2011-2022 走看看