From fcb8e1f255e02cc24bb06f09ff5a15e14fcba058 Mon Sep 17 00:00:00 2001 From: missum Date: Wed, 4 Mar 2026 22:00:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=85=8D=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=BB=98=E8=AE=A4=E5=9D=90=E6=A0=87=E7=B3=BB?= =?UTF-8?q?=E4=B8=BA=20EPSG:4490=EF=BC=8C=E8=B0=83=E6=95=B4=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E7=AD=89=E7=BA=A7=E4=B8=BA=20ERROR=EF=BC=9B=E6=B8=85?= =?UTF-8?q?=E7=90=86=E6=9C=AA=E4=BD=BF=E7=94=A8=E7=9A=84=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=92=8C=E5=B8=B8=E9=87=8F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- geo_tools/__init__.py | 140 +---------------------------------- geo_tools/config/settings.py | 4 +- geo_tools/core/projection.py | 7 -- 3 files changed, 3 insertions(+), 148 deletions(-) diff --git a/geo_tools/__init__.py b/geo_tools/__init__.py index cd0631c..d0739a4 100644 --- a/geo_tools/__init__.py +++ b/geo_tools/__init__.py @@ -30,149 +30,11 @@ except PackageNotFoundError: # ── 配置 & 日志 ─────────────────────────────────────────────────────────────── from geo_tools.config.settings import settings from geo_tools.utils.logger import get_logger, set_global_level -from geo_tools.utils.validators import ( - SUPPORTED_VECTOR_EXTENSIONS, - is_supported_vector_format, - is_valid_crs, - validate_crs, - validate_geometry, - validate_vector_path, -) - -# ── IO ──────────────────────────────────────────────────────────────────────── -from geo_tools.io.readers import ( - list_gdb_layers, - list_gpkg_layers, - read_csv_points, - read_gdb, - read_gpkg, - read_vector, -) -from geo_tools.io.writers import ( - write_csv, - write_gdb, - write_gpkg, - write_vector, -) - -# ── 核心处理 ────────────────────────────────────────────────────────────────── -from geo_tools.core.geometry import ( - buffer_geometry, - bounding_box, - centroid, - contains, - convex_hull, - difference, - distance_between, - fix_geometry, - intersect, - intersects, - is_valid_geometry, - symmetric_difference, - unary_union, - union, - within, -) -from geo_tools.core.projection import ( - CGCS2000, - CGCS2000_UTM_50N, - WEB_MERCATOR, - WGS84, - crs_to_epsg, - get_crs_info, - suggest_projected_crs, - transform_coordinates, - transform_point, -) -from geo_tools.core.vector import ( - add_area_column, - clip_to_extent, - dissolve_by, - drop_invalid_geometries, - explode_multipart, - reproject, - set_crs, - spatial_join, -) - -# ── 空间分析 ────────────────────────────────────────────────────────────────── -from geo_tools.analysis.spatial_ops import ( - buffer_and_overlay, - nearest_features, - overlay, - select_by_location, -) -from geo_tools.analysis.stats import ( - area_weighted_mean, - count_by_polygon, - summarize_attributes, -) __all__ = [ "__version__", "settings", # utils "get_logger", - "set_global_level", - "is_valid_crs", - "validate_crs", - "validate_geometry", - "is_supported_vector_format", - "validate_vector_path", - "SUPPORTED_VECTOR_EXTENSIONS", - # io - readers - "read_vector", - "read_gdb", - "list_gdb_layers", - "read_gpkg", - "list_gpkg_layers", - "read_csv_points", - # io - writers - "write_vector", - "write_gdb", - "write_gpkg", - "write_csv", - # core - geometry - "is_valid_geometry", - "fix_geometry", - "buffer_geometry", - "centroid", - "bounding_box", - "convex_hull", - "intersect", - "union", - "difference", - "symmetric_difference", - "unary_union", - "contains", - "within", - "intersects", - "distance_between", - # core - projection - "WGS84", - "CGCS2000", - "WEB_MERCATOR", - "CGCS2000_UTM_50N", - "get_crs_info", - "crs_to_epsg", - "transform_coordinates", - "transform_point", - "suggest_projected_crs", - # core - vector - "reproject", - "set_crs", - "clip_to_extent", - "dissolve_by", - "explode_multipart", - "drop_invalid_geometries", - "spatial_join", - "add_area_column", - # analysis - "buffer_and_overlay", - "overlay", - "nearest_features", - "select_by_location", - "area_weighted_mean", - "summarize_attributes", - "count_by_polygon", + "set_global_level" ] diff --git a/geo_tools/config/settings.py b/geo_tools/config/settings.py index 7ecffcf..41512a7 100644 --- a/geo_tools/config/settings.py +++ b/geo_tools/config/settings.py @@ -42,7 +42,7 @@ class GeoToolsSettings(BaseSettings): """日志文件目录。""" # ── 坐标系配置 ──────────────────────────────────────────── - default_crs: str = "EPSG:4326" + default_crs: str = "EPSG:4490" """默认地理坐标系,使用 EPSG 代码字符串。 常见值: - ``EPSG:4326`` — WGS84 经纬度 @@ -51,7 +51,7 @@ class GeoToolsSettings(BaseSettings): """ # ── 日志配置 ────────────────────────────────────────────── - log_level: str = "INFO" + log_level: str = "ERROR" """日志等级:DEBUG / INFO / WARNING / ERROR / CRITICAL。""" log_to_file: bool = True diff --git a/geo_tools/core/projection.py b/geo_tools/core/projection.py index 5e07120..cbd424e 100644 --- a/geo_tools/core/projection.py +++ b/geo_tools/core/projection.py @@ -13,13 +13,6 @@ from geo_tools.utils.logger import get_logger logger = get_logger(__name__) -# ── 常用 CRS 快捷常量 ────────────────────────────────────────────────────────── -WGS84 = "EPSG:4326" # 地理坐标系(经纬度) -CGCS2000 = "EPSG:4490" # 中国国家大地坐标系 2000 -WEB_MERCATOR = "EPSG:3857" # Web Mercator(米) -CGCS2000_UTM_50N = "EPSG:4508" # CGCS2000 / 3-degree Gauss-Kruger zone 50N - - def get_crs_info(crs_input: str | int) -> dict[str, str | int | None]: """获取 CRS 的基本信息。