refactor: 重构项目结构,将geo_tools重命名为app并更新相关引用

- 将主包名从geo_tools改为app
- 更新所有模块中的引用路径
- 迁移并更新测试用例
- 添加项目规则文档
- 保持原有功能不变,仅进行结构调整
This commit is contained in:
2026-04-12 19:49:56 +08:00
parent fcb8e1f255
commit db51d41aef
41 changed files with 4132 additions and 808 deletions

View File

@@ -3,19 +3,31 @@ import os
os.environ["OGR_ORGANIZE_POLYGONS"] = "SKIP"
from pathlib import Path
import geopandas as gpd
# 添加项目根目录到路径
project_root = Path(__file__).parent.parent
sys.path.insert(0, str(project_root))
import geo_tools
from geo_tools.core import projection
from geo_tools.config.project_enum import CRS
import app
from app.core import projection
from app.config.project_enum import CRS
info = projection.get_crs_info(CRS.CGCS2000_6_DEGREE_ZONE_18.value)
print(info)
print(type(CRS.CGCS2000_3_DEGREE_ZONE_27))
input_folder = r"E:\@三普\@二普和测土配方样点处理\云南省"
output_folder = r"E:\@三普\@二普和测土配方样点处理\云南省_投影转换"
# aa = geo_tools.read_vector(r"E:\@三普\@临时文件夹\样点异常值剔除\容县\异常样点数据\AB_outliers.shp")
# projection.reproject_gdf(aa,CRS.CGCS2000_3_DEGREE_ZONE_37).to_file(r"E:\@三普\@临时文件夹\样点异常值剔除\容县\AB_ou.shp")
for root, dirs, files in os.walk(input_folder):
for file in files:
if file.endswith(".shp"):
input_path = os.path.join(root, file)
output_path = os.path.join(output_folder, os.path.relpath(input_path, input_folder))
os.makedirs(os.path.dirname(output_path), exist_ok=True)
gdf = gpd.read_file(input_path)
if gdf.crs is not None:
reproject_gdf = projection.reproject_gdf(gdf, auto_crs=True)
reproject_gdf.to_file(output_path)
print("Reprojected CRS:", reproject_gdf.crs)
else:
print("No CRS information found.")