wanger преди 1 месец
родител
ревизия
053d9adb9b

+ 8 - 1
appconfig.py

@@ -13,7 +13,14 @@ SDE = {
 }
 
 # 数据库
-DB_CONN = 'KJGH/KJGH@192.168.60.20:1521/orclpdb'
+DB_CONN = 'KJGH/KJGH@127.0.0.1:1521/orclpdb'
+
+# 专题图相关配置项
+ZTZT = {
+    "symbology_lyr": r"D:\gisdata\通辽\FXFW.lyr",  # 这个是为了给分析范围增加红色边框样式的lyr文件
+    "mask_lyr": r"D:\gisdata\通辽\MASK.lyr",  # 这个是为了给分析范围外增加白色掩膜样式的lyr文件
+    "temp_dir": r"C:\temp\ztt_mxds"  # 临时文件目录  会存放mxd文件和行政区范围shp文件
+}
 
 # 行政区
 XZQ = [

BIN
appconfig.pyc


BIN
ctfx/__init__.pyc


+ 10 - 1
ctfx/ctfx.py

@@ -188,5 +188,14 @@ class Ctfx:
             , self.outputname
             , self.outGdb
             , bsm
-            , statist)
+            , "")
         self.db.insert(sql)
+        # 为了解决clob字段插入sql长度有4000的限制  分批插入statist统计信息
+        chunk_size = 3000
+        for i in range(0, len(statist), chunk_size):
+            chunk = statist[i:i + chunk_size]
+            sql = "update t_fxpj_ctfx_main t set statist = statist||'{1}' where t.id = '{0}'"
+            sql = sql.format(
+                bsm
+                , chunk)
+            self.db.insert(sql)

BIN
ctfx/ctfx.pyc


BIN
db/__init__.pyc


BIN
db/oracle.pyc


BIN
fzjbnt/__init__.pyc


BIN
fzjbnt/fzjbnt.pyc


BIN
fzxz/__init__.pyc


BIN
fzxz/fzxz.pyc


BIN
fzxz/fzxzmap.pyc


+ 0 - 0
ghcy/__init__.py


+ 206 - 0
ghcy/ghcy.py

@@ -0,0 +1,206 @@
+# -*- coding: utf-8 -*-
+
+import arcpy
+import os
+import datetime
+
+
+def calculate_spatial_relationship_optimized():
+    try:
+        # 设置工作环境
+        arcpy.env.overwriteOutput = True
+        # 输入参数配置
+        A_table = r"D:\Python\sde\KJGH.sde\SDE.ZXCQ_XXGH"  # A表SDE路径
+        B_table = r"D:\Python\sde\KJGH.sde\SDE.ZXCQ_ZTGH"  # B表SDE路径
+        output_folder = r"D:\test\ghcy"  # 输出文件夹路径
+        # 创建输出文件夹
+        if not os.path.exists(output_folder):
+            os.makedirs(output_folder)
+        # 时间戳用于生成唯一文件名
+        timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
+        # 临时工作空间
+        temp_workspace = "in_memory"
+        print("开始处理SDE.ZXCQ_XXGH和SDE.ZXCQ_ZTGH的空间关系...")
+        # 验证表是否存在
+        if not arcpy.Exists(A_table):
+            print("错误: A表不存在 - {0}".format(A_table))
+            return
+        if not arcpy.Exists(B_table):
+            print("错误: B表不存在 - {0}".format(B_table))
+            return
+        # 检查必需字段是否存在
+        required_fields = ["YDYHFLDM", "YDYHFLMC"]
+        a_fields = [f.name for f in arcpy.ListFields(A_table)]
+        b_fields = [f.name for f in arcpy.ListFields(B_table)]
+        for field in required_fields:
+            if field not in a_fields:
+                print("错误: A表中找不到 {0} 字段".format(field))
+                print("A表字段列表: {0}".format(a_fields))
+                return
+            if field not in b_fields:
+                print("错误: B表中找不到 {0} 字段".format(field))
+                print("B表字段列表: {0}".format(b_fields))
+                return
+        print("字段验证通过,开始处理...")
+        # 步骤1: 定义查询字段(只保留需要的字段)
+        a_cursor_fields = ["OID@", "SHAPE@", "YDYHFLDM", "YDYHFLMC"]
+        b_cursor_fields = ["OID@", "SHAPE@", "YDYHFLDM", "YDYHFLMC"]
+        # 用于存储需要裁剪的要素
+        features_to_clip = []
+        # 创建B表的临时图层
+        print("正在创建临时图层...")
+        B_layer = "B_table_layer"
+        arcpy.MakeFeatureLayer_management(B_table, B_layer)
+        print("开始遍历A表要素...")
+        with arcpy.da.SearchCursor(A_table, a_cursor_fields) as a_cursor:
+            a_count = 0
+            processed_count = 0
+            for a_row in a_cursor:
+                a_count += 1
+                a_oid = a_row[0]
+                a_geometry = a_row[1]
+                a_ydyhfldm = a_row[2]
+                a_ydyhflmc = a_row[3]
+                if a_count % 100 == 0:
+                    print("已处理 {0} 个A表要素,找到 {1} 个需要裁剪的要素".format(a_count, processed_count))
+                # 检查几何是否有效
+                if a_geometry is None or a_geometry.length == 0:
+                    continue
+                try:
+                    # 使用SelectLayerByLocation选择与A表要素相交的B表要素
+                    arcpy.SelectLayerByLocation_management(B_layer, "INTERSECT", a_geometry)
+                    # 获取选中的要素数量
+                    result = arcpy.GetCount_management(B_layer)
+                    selected_count = int(result.getOutput(0))
+                    if selected_count > 0:
+                        # 遍历选中的B表要素
+                        with arcpy.da.SearchCursor(B_layer, b_cursor_fields) as b_cursor:
+                            for b_row in b_cursor:
+                                b_oid = b_row[0]
+                                b_geometry = b_row[1]
+                                b_ydyhfldm = b_row[2]
+                                b_ydyhflmc = b_row[3]
+                                # 检查几何是否有效
+                                if b_geometry is None or b_geometry.length == 0:
+                                    continue
+                                # 处理YDYHFLDM字段比较
+                                a_ydyhfldm_str = str(a_ydyhfldm) if a_ydyhfldm is not None else ""
+                                b_ydyhfldm_str = str(b_ydyhfldm) if b_ydyhfldm is not None else ""
+                                # 判断是否需要执行后续操作
+                                need_process = False
+                                if b_ydyhfldm_str.endswith('0000'):
+                                    # 如果b_ydyhfldm_str以0000结尾,比较前两位
+                                    if len(a_ydyhfldm_str) >= 2 and len(b_ydyhfldm_str) >= 2:
+                                        if a_ydyhfldm_str[:2] != b_ydyhfldm_str[:2]:
+                                            need_process = True
+                                else:
+                                    # 其他情况,直接比较整个字符串
+                                    if a_ydyhfldm_str != b_ydyhfldm_str:
+                                        need_process = True
+                                if need_process:
+                                    processed_count += 1
+                                    if processed_count % 50 == 0:
+                                        print(
+                                            "  发现第 {0} 个不一致要素: A表OID={1}, B表OID={2}".format(processed_count,
+                                                                                                       a_oid, b_oid))
+                                    # 获取相交部分几何
+                                    try:
+                                        intersect_geom = a_geometry.intersect(b_geometry, 4)  # 4表示平面相交
+                                        # 检查相交几何是否有效
+                                        if intersect_geom is not None and intersect_geom.length > 0:
+                                            # 创建要素信息
+                                            a_feature = {
+                                                'geometry': intersect_geom,
+                                                'a_ydyhfldm': a_ydyhfldm_str,
+                                                'a_ydyhflmc': str(a_ydyhflmc) if a_ydyhflmc is not None else "",
+                                                'b_ydyhfldm': b_ydyhfldm_str,
+                                                'b_ydyhflmc': str(b_ydyhflmc) if b_ydyhflmc is not None else ""
+                                            }
+                                            features_to_clip.append(a_feature)
+                                    except Exception as e:
+                                        print("  计算相交几何时出错: {0}".format(e))
+                                        continue
+                except Exception as e:
+                    print("  空间查询B表时出错: {0}".format(e))
+                    continue
+        # 清理临时图层
+        try:
+            arcpy.Delete_management(B_layer)
+        except:
+            pass
+        print("处理完成!总共处理了 {0} 个A表要素,找到 {1} 个需要裁剪的要素".format(a_count, len(features_to_clip)))
+        # 如果有需要处理的要素,进行导出
+        if features_to_clip:
+            print("开始导出 {0} 个裁剪要素...".format(len(features_to_clip)))
+            # 创建输出要素类
+            output_fc_name = "clipped_features_{0}".format(timestamp)
+            output_fc_path = os.path.join(temp_workspace, output_fc_name)
+            # 获取空间参考
+            spatial_ref = arcpy.Describe(A_table).spatialReference
+            # 创建输出要素类
+            arcpy.CreateFeatureclass_management(temp_workspace,
+                                                output_fc_name,
+                                                "POLYGON",
+                                                None,
+                                                "DISABLED",
+                                                "DISABLED",
+                                                spatial_ref)
+
+            # 添加必需字段
+            arcpy.AddField_management(output_fc_path, "A_YDYHFLDM", "TEXT", "", "", 50)
+            arcpy.AddField_management(output_fc_path, "A_YDYHFLMC", "TEXT", "", "", 100)
+            arcpy.AddField_management(output_fc_path, "B_YDYHFLDM", "TEXT", "", "", 50)
+            arcpy.AddField_management(output_fc_path, "B_YDYHFLMC", "TEXT", "", "", 100)
+            # 准备插入字段列表
+            output_fields = [
+                "SHAPE@",
+                "A_YDYHFLDM",
+                "A_YDYHFLMC",
+                "B_YDYHFLDM",
+                "B_YDYHFLMC"
+            ]
+            print("输出字段: {0}".format(output_fields))
+            # 插入数据
+            print("正在插入裁剪后的要素...")
+            inserted_count = 0
+            with arcpy.da.InsertCursor(output_fc_path, output_fields) as insert_cursor:
+                for feature in features_to_clip:
+                    try:
+                        # 构建插入行数据
+                        row_data = [
+                            feature['geometry'],
+                            feature['a_ydyhfldm'],
+                            feature['a_ydyhflmc'],
+                            feature['b_ydyhfldm'],
+                            feature['b_ydyhflmc']
+                        ]
+                        insert_cursor.insertRow(row_data)
+                        inserted_count += 1
+                        if inserted_count % 100 == 0:
+                            print("已插入 {0} 个要素".format(inserted_count))
+                    except Exception as e:
+                        print("插入要素时出错: {0}".format(e))
+                        continue
+            # 导出为Shapefile
+            output_shp = os.path.join(output_folder, "clipped_results_{0}.shp".format(timestamp))
+            arcpy.CopyFeatures_management(output_fc_path, output_shp)
+            mjField = "TBMJ"
+            arcpy.AddField_management(output_shp, mjField, "DOUBLE")
+            arcpy.CalculateField_management(output_shp, mjField, "!shape.area@SQUAREMETERS!", "PYTHON_9.3")
+            print("结果已导出到: {0}".format(output_shp))
+            print("总共导出了 {0} 个要素".format(inserted_count))
+            # 清理临时数据
+            try:
+                arcpy.Delete_management(output_fc_path)
+            except:
+                pass
+        else:
+            print("没有找到需要裁剪的要素")
+        print("处理完成!")
+    except Exception as e:
+        print("处理过程中发生错误: {0}".format(e))
+        import traceback
+        print(traceback.format_exc())
+
+if __name__ == "__main__":
+    calculate_spatial_relationship_optimized()

+ 128 - 0
ghcy/spatial_clip_tables.py

@@ -0,0 +1,128 @@
+# -*- coding: utf-8 -*-
+
+import arcpy
+import os
+
+# 设置工作环境
+arcpy.env.workspace = r"D:\Python\sde\SDE.sde"
+arcpy.env.overwriteOutput = True
+
+
+def spatial_clip_tables(feature_A, feature_B, output_B_minus_A, output_A_minus_B, where_clause,
+                        temp_workspace=r"D:\Python\sde", mjField="TBMJ"):
+    try:
+        # 定义要素类/表名
+        # feature_A = "SDE.ZXCQ_ZTGH"
+        # feature_B = "SDE.ZXCQ_LD"
+        # 使用文件地理数据库作为临时输出
+        # temp_workspace = r"D:\Python\sde"  # 修改为您的临时目录
+        if not os.path.exists(temp_workspace):
+            os.makedirs(temp_workspace)
+        temp_gdb = os.path.join(temp_workspace, "temp_analysis.gdb")
+        if not arcpy.Exists(temp_gdb):
+            arcpy.CreateFileGDB_management(temp_workspace, "temp_analysis.gdb")
+
+        # 输出要素类名称
+        # output_B_minus_A = "ZXCQ_LD_WITHOUT_ZTGH"
+        # output_A_minus_B = "ZXCQ_ZTGH_WITHOUT_LD"
+
+        # 构建查询条件
+        # where_clause = "YDYHFLDM LIKE '1401%' OR YDYHFLDM LIKE '1402%'"
+        print("正在处理数据...")
+
+        # 步骤1: 筛选A表数据到文件地理数据库
+        temp_A = os.path.join(temp_gdb, "temp_A")
+        arcpy.Select_analysis(feature_A, temp_A, where_clause)
+
+        # 步骤2: 复制B表到文件地理数据库
+        temp_B = os.path.join(temp_gdb, "temp_B")
+        arcpy.CopyFeatures_management(feature_B, temp_B)
+
+        print("正在计算空间差异...")
+
+        # 在文件地理数据库中执行Erase操作
+        temp_output_B = os.path.join(temp_gdb, "temp_B_minus_A")
+        temp_output_A = os.path.join(temp_gdb, "temp_A_minus_B")
+
+        arcpy.Erase_analysis(temp_B, temp_A, temp_output_B)
+        arcpy.Erase_analysis(temp_A, temp_B, temp_output_A)
+
+        # 将结果复制回SDE
+        print("正在将结果写入SDE数据库...")
+
+        # 删除已存在的输出
+        for output_name in [output_B_minus_A, output_A_minus_B]:
+            full_output_path = os.path.join(arcpy.env.workspace, output_name)
+            if arcpy.Exists(full_output_path):
+                arcpy.Delete_management(full_output_path)
+
+        # 复制到SDE
+        arcpy.CopyFeatures_management(temp_output_B, os.path.join(arcpy.env.workspace, output_B_minus_A))
+        arcpy.CopyFeatures_management(temp_output_A, os.path.join(arcpy.env.workspace, output_A_minus_B))
+
+        # 清理字段
+        fields_to_keep = ["YDYHFLDM", "YDYHFLMC", "XXGHBZDYBH", "XXGHBZDYMC", "OBJECTID", "Shape", "SHAPE",
+                          "Shape_Length", "Shape_Area", "SHAPE.LEN", "SHAPE.AREA"]
+
+        for output_name in [output_B_minus_A, output_A_minus_B]:
+            output_path = os.path.join(arcpy.env.workspace, output_name)
+            field_names = [f.name for f in arcpy.ListFields(output_path)]
+            for field in field_names:
+                if field not in fields_to_keep:
+                    try:
+                        arcpy.DeleteField_management(output_path, field)
+                    except:
+                        pass  # 忽略无法删除的字段
+        output_path_B = os.path.join(arcpy.env.workspace, output_B_minus_A)
+        output_path_A = os.path.join(arcpy.env.workspace, output_A_minus_B)
+
+        arcpy.AddField_management(output_path_B, mjField, "DOUBLE")
+        arcpy.CalculateField_management(output_path_B, mjField, "!shape.area@SQUAREMETERS!", "PYTHON_9.3")
+
+        arcpy.AddField_management(output_path_A, mjField, "DOUBLE")
+        arcpy.CalculateField_management(output_path_A, mjField, "!shape.area@SQUAREMETERS!", "PYTHON_9.3")
+        print("空间差异分析完成!")
+        print("B中不与A相交的部分: {0}".format(output_path_B))
+        print("A中不与B相交的部分: {0}".format(output_path_A))
+        # 清理临时文件地理数据库
+        if arcpy.Exists(temp_gdb):
+            arcpy.Delete_management(temp_gdb)
+        return output_path_B, output_path_A
+    except Exception as e:
+        print("发生错误: {0}".format(str(e)))
+        import traceback
+        print(traceback.format_exc())
+
+
+# 主执行函数
+if __name__ == "__main__":
+    print("=== 空间裁剪分析 ===")
+    print("\n1. 执行常规空间裁剪...")
+    # 绿地与详细规划
+    result1 = spatial_clip_tables(feature_A="SDE.ZXCQ_XXGH",
+                                  feature_B="SDE.ZXCQ_LD",
+                                  output_B_minus_A="ZXCQ_LD_WITHOUT_XXGH",
+                                  output_A_minus_B="ZXCQ_XXGH_WITHOUT_LD",
+                                  where_clause="YDYHFLDM LIKE '1401%' OR YDYHFLDM LIKE '1402%'")
+
+    # 绿地与总体规划
+    result1 = spatial_clip_tables(feature_A="SDE.ZXCQ_ZTGH",
+                                  feature_B="SDE.ZXCQ_LD",
+                                  output_B_minus_A="ZXCQ_LD_WITHOUT_ZTGH",
+                                  output_A_minus_B="ZXCQ_ZTGH_WITHOUT_LD",
+                                  where_clause="YDYHFLDM LIKE '1401%' OR YDYHFLDM LIKE '1402%'")
+
+    # 广场与总体规划
+    result1 = spatial_clip_tables(feature_A="SDE.ZXCQ_ZTGH",
+                                  feature_B="SDE.ZXCQ_GC",
+                                  output_B_minus_A="ZXCQ_GC_WITHOUT_ZTGH",
+                                  output_A_minus_B="ZXCQ_ZTGH_WITHOUT_GC",
+                                  where_clause="YDYHFLDM LIKE '1403%'")
+
+    # 广场与详细规划
+    result1 = spatial_clip_tables(feature_A="SDE.ZXCQ_XXGH",
+                                  feature_B="SDE.ZXCQ_GC",
+                                  output_B_minus_A="ZXCQ_GC_WITHOUT_XXGH",
+                                  output_A_minus_B="ZXCQ_XXGH_WITHOUT_GC",
+                                  where_clause="YDYHFLDM LIKE '1403%'")
+    print("\n所有处理完成!")

BIN
hgxfx/__init__.pyc


BIN
hgxfx/hgxfx.pyc


BIN
jsyd/__init__.pyc


BIN
jsyd/jsyd.pyc


BIN
log.pyc


+ 12 - 0
main.py

@@ -11,7 +11,9 @@ from fzjbnt.fzjbnt import FzJbnt
 from fzxz.fzxz import Fzxz
 from fzxz.fzxzmap import FzxzMap
 from hgxfx.hgxfx import Hgxfx
+from hgxfx.hgxfxexport import HgxfxExport
 from ztt.ztt import Ztt
+from ztzt.ztzt import Ztzt
 from ctfx.ctfx import Ctfx
 from clipFeature.clipFeature import ClipFeature
 from xmydsyx.xmydsyx import Xmydsyx
@@ -29,7 +31,9 @@ def run(fun, data):
             'FzxzMap': fzxzMap,
             'FzJbnt': fzJbnt,
             'Hgxfx': hgxfx,
+            'HgxfxExport': hgxfxExport,
             'Ztt': ztt,
+            'Ztzt': ztzt,
             'Ctfx': ctfx,
             'Xmydsyx': xmydsyx,
             'ClipFeature': clipFeature,
@@ -50,6 +54,10 @@ def run(fun, data):
 def default(data):
     print('No such case')
 
+# 专题图制图
+def ztzt(data):
+    mp = Ztzt(data)
+    mp.run()
 
 # 模型构建
 def modelBuider(data):
@@ -78,6 +86,10 @@ def hgxfx(data):
     mp = Hgxfx(data["bsm"])
     mp.run()
 
+def hgxfxExport(data):
+    mp = HgxfxExport(data["bsm"])
+    mp.run()
+
 
 # 冲突分析
 def ctfx(data):

BIN
mxds/fzxz/fzxz.dbf


BIN
mxds/fzxz/fzxz.sbn


BIN
mxds/fzxz/fzxz.sbx


BIN
mxds/fzxz/fzxz.shp


Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
mxds/fzxz/fzxz.shp.xml


BIN
mxds/fzxz/fzxz.shx


+ 145 - 0
mxdupdate.py

@@ -0,0 +1,145 @@
+# -*- coding: utf-8 -*-
+import arcpy
+import os
+import re
+
+
+def update_sde_connection_in_mxd(mxd_path, old_ip, new_ip):
+    """
+    更新 MXD 文件中所有图层的 SDE 连接 IP
+
+    参数:
+    mxd_path: MXD 文件路径
+    old_ip: 旧的 IP 地址(可以是部分匹配)
+    new_ip: 新的 IP 地址
+    """
+    try:
+        # 打开 MXD
+        mxd = arcpy.mapping.MapDocument(mxd_path)
+        print("\n处理文件: {os.path.basename(mxd_path)}")
+
+        # 更新数据框中的所有图层
+        layers_updated = 0
+        for df in arcpy.mapping.ListDataFrames(mxd):
+            for lyr in arcpy.mapping.ListLayers(mxd, "", df):
+                if lyr.supports("DATASOURCE"):
+                    # 获取当前数据源
+                    current_source = lyr.dataSource
+
+                    # 检查是否为 SDE 连接并包含旧 IP
+                    if "sde" in current_source.lower() and old_ip in current_source:
+                        # 构建新的数据源路径
+                        new_source = current_source.replace(old_ip, new_ip)
+
+                        try:
+                            # 更新图层数据源
+                            lyr.replaceDataSource(
+                                os.path.dirname(new_source),  # 工作空间路径
+                                "SDE_WORKSPACE",  # 工作空间类型
+                                os.path.basename(new_source),  # 数据集名称
+                                False  # 不验证
+                            )
+                            layers_updated += 1
+                            print("  已更新: {lyr.name}")
+                            print("    原连接: {current_source}")
+                            print("    新连接: {new_source}")
+                        except Exception as e:
+                            print("  更新失败 {lyr.name}: {str(e)}")
+
+        # 保存 MXD
+        if layers_updated > 0:
+            mxd.save()
+            print("  保存成功,更新了 {layers_updated} 个图层")
+        else:
+            print("  未找到需要更新的 SDE 连接")
+
+        # 释放 MXD 对象
+        del mxd
+
+        return True
+
+    except Exception as e:
+        print("处理失败 {mxd_path}: {str(e)}")
+        return False
+
+
+def batch_update_sde_connections(folder_path, old_ip, new_ip, recursive=False):
+    """
+    批量处理文件夹中的 MXD 文件
+
+    参数:
+    folder_path: 文件夹路径
+    old_ip: 旧的 IP 地址
+    new_ip: 新的 IP 地址
+    recursive: 是否递归处理子文件夹
+    """
+    # 支持的 MXD 文件扩展名
+    extensions = ['.mxd', '.MXD']
+
+    # 收集所有 MXD 文件
+    mxd_files = []
+
+    if recursive:
+        for root, dirs, files in os.walk(folder_path):
+            for file in files:
+                if os.path.splitext(file)[1] in extensions:
+                    mxd_files.append(os.path.join(root, file))
+    else:
+        for file in os.listdir(folder_path):
+            if os.path.splitext(file)[1] in extensions:
+                mxd_files.append(os.path.join(folder_path, file))
+
+    print("找到 {len(mxd_files)} 个 MXD 文件")
+
+    # 处理每个 MXD 文件
+    success_count = 0
+    for mxd_file in mxd_files:
+        if update_sde_connection_in_mxd(mxd_file, old_ip, new_ip):
+            success_count += 1
+
+    print("\n处理完成!成功处理 {success_count}/{len(mxd_files)} 个文件")
+
+
+def update_sde_connection_file(connection_file, old_ip, new_ip):
+    """
+    直接更新 SDE 连接文件 (.sde)
+    """
+    try:
+        # 读取连接文件内容
+        with open(connection_file, 'r') as f:
+            content = f.read()
+
+        # 替换 IP 地址
+        new_content = content.replace(old_ip, new_ip)
+
+        # 保存文件
+        with open(connection_file, 'w') as f:
+            f.write(new_content)
+
+        print("已更新连接文件: {os.path.basename(connection_file)}")
+        return True
+
+    except Exception as e:
+        print("更新连接文件失败: {str(e)}")
+        return False
+
+
+# ==================== 使用示例 ====================
+
+if __name__ == "__main__":
+    # 示例 1: 处理单个 MXD 文件
+    print("=== 示例 1: 处理单个 MXD 文件 ===")
+    # update_sde_connection_in_mxd(
+    #     r"C:\Project\maps\project.mxd",
+    #     "192.168.1.100",  # 旧 IP
+    #     "10.255.133.176"  # 新 IP
+    # )
+
+    # 示例 2: 批量处理文件夹
+    print("\n=== 示例 2: 批量处理文件夹 ===")
+    batch_update_sde_connections(
+        r"C:\TEMP\1",  # 文件夹路径
+        "192.168.100.252",  # 旧 IP
+        "192.168.60.20",  # 新 IP
+        recursive=True  # 递归处理子文件夹
+    )

+ 0 - 0
pdf/__init__.py


+ 36 - 0
pdf/pdf_tables_to_excel.py

@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+import tabula
+import pandas as pd
+
+
+def pdf_tables_to_excel(pdf_path, excel_path, pages='77-84'):
+    """
+    使用tabula提取PDF表格
+    """
+    try:
+        # 读取PDF表格
+        tables = tabula.read_pdf(pdf_path, pages=pages, multiple_tables=True, lattice=True)
+
+        print("找到 {len(tables)} 个表格")
+
+        with pd.ExcelWriter(excel_path, engine='openpyxl') as writer:
+            for i, df in enumerate(tables):
+                sheet_name = 'Table_{i + 1}'
+                # 确保sheet名称有效
+                sheet_name = sheet_name[:31]
+                df.to_excel(writer, sheet_name=sheet_name, index=False)
+
+                print("表格 {i + 1}: {df.shape[0]} 行 x {df.shape[1]} 列")
+
+        print("导出完成: {excel_path}")
+
+    except Exception as e:
+        print("错误: {e}")
+
+
+# 使用示例
+if __name__ == "__main__":
+    pdf_tables_to_excel(
+        "E:\projects\通辽市一张图监督实施系统\体检成果\22成果-20240704按部下发实体地域修改后成果\通辽市2022年度城市体检评估报告.pd",
+        "E:\projects\通辽市一张图监督实施系统\体检成果\22成果-20240704按部下发实体地域修改后成果\output.xlsx",
+        pages='77-84')

BIN
utils.pyc


BIN
utilsgis.pyc


BIN
xmydsyx/__init__.pyc


BIN
xmydsyx/xmydsyx.pyc


BIN
zbmx/__init__.pyc


BIN
zbmx/arcTools.pyc


BIN
zbmx/modelFlow.pyc


BIN
zbmx/resultTools.pyc


BIN
zbmx/zbmx.pyc


BIN
ztt/__init__.pyc


BIN
ztt/ztt.pyc


Някои файлове не бяха показани, защото твърде много файлове са промени