gis

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GIS Skill — Integration Reference

GIS技能 —— 集成参考

Cross-application geospatial skill covering supported CRS, data formats, and application integration steps for the
digitalmodel.gis
module (WRK-020).

跨应用地理空间技能,涵盖
digitalmodel.gis
模块(WRK-020)支持的CRS、数据格式以及应用集成步骤。

1. Supported Coordinate Reference Systems

1. 支持的坐标参考系统

EPSGNameUse case
EPSG:4326WGS84 geographicDefault for GeoJSON, GPS, BSEE well data
EPSG:3857Web Mercator (Pseudo-Mercator)Tile maps (Google Maps, OpenStreetMap)
EPSG:32601–32660UTM Zone 1N–60NNorthern hemisphere metre-accurate work
EPSG:32701–32760UTM Zone 1S–60SSouthern hemisphere metre-accurate work
EPSG:4269NAD83US onshore regulatory data
Auto-detect UTM zone from longitude:
python
from digitalmodel.gis.core.crs import get_utm_epsg
epsg = get_utm_epsg(longitude=-1.5, latitude=57.0)  # returns "EPSG:32630"

EPSG名称使用场景
EPSG:4326WGS84地理坐标系GeoJSON、GPS、BSEE油井数据的默认坐标系
EPSG:3857Web墨卡托(伪墨卡托)瓦片地图(谷歌地图、OpenStreetMap)
EPSG:32601–32660UTM 1N–60N区北半球米级精度作业
EPSG:32701–32760UTM 1S–60S区南半球米级精度作业
EPSG:4269NAD83美国陆上监管数据
根据经度自动检测UTM时区:
python
from digitalmodel.gis.core.crs import get_utm_epsg
epsg = get_utm_epsg(longitude=-1.5, latitude=57.0)  # returns "EPSG:32630"

2. Supported Data Formats

2. 支持的数据格式

FormatExtensionsHandlerNotes
GeoJSON.geojson, .json
io.geojson_handler.GeoJSONHandler
No extra deps; RFC 7946
KML / KMZ.kml, .kmz
io.kml_handler.KMLHandler
Pure stdlib xml.etree
Shapefile.shp + .dbf + .shx
io.shapefile_handler.ShapefileHandler
Requires geopandas/fiona
GeoTIFF.tif, .tiff
io.geotiff_handler.GeoTIFFHandler
Requires rasterio
CSV + lat/lon.csv
layers.feature_layer.FeatureLayer
Standard pandas read
WKTembedded in .qgs / .csv
core.geometry
Used in QGIS project files

格式扩展名处理器备注
GeoJSON.geojson, .json
io.geojson_handler.GeoJSONHandler
无需额外依赖;符合RFC 7946标准
KML / KMZ.kml, .kmz
io.kml_handler.KMLHandler
仅使用标准库xml.etree
Shapefile.shp + .dbf + .shx
io.shapefile_handler.ShapefileHandler
需要依赖geopandas/fiona
GeoTIFF.tif, .tiff
io.geotiff_handler.GeoTIFFHandler
需要依赖rasterio
CSV + 经纬度.csv
layers.feature_layer.FeatureLayer
标准pandas读取
WKT嵌入在.qgs / .csv中
core.geometry
用于QGIS项目文件

3. Application Integration

3. 应用集成

3.1 QGIS

3.1 QGIS

Generate a ready-to-open
.qgs
project file from a
WellLayer
:
python
from digitalmodel.gis.integrations.qgis_export import QGISExporter
from digitalmodel.gis.layers.well_layer import WellLayer

layer = WellLayer.from_csv("wells.csv", lat_col="lat", lon_col="lon")
exporter = QGISExporter(layer)
exporter.generate_project("wells.qgs")          # open in QGIS 3.x
exporter.generate_well_qml("wells_style.qml")  # well marker style
Load a GeoTIFF bathymetry layer inside QGIS Processing Python console:
python
iface.addRasterLayer("/path/to/bathymetry.tif", "Bathymetry")
WellLayer
生成可直接打开的
.qgs
项目文件:
python
from digitalmodel.gis.integrations.qgis_export import QGISExporter
from digitalmodel.gis.layers.well_layer import WellLayer

layer = WellLayer.from_csv("wells.csv", lat_col="lat", lon_col="lon")
exporter = QGISExporter(layer)
exporter.generate_project("wells.qgs")          # open in QGIS 3.x
exporter.generate_well_qml("wells_style.qml")  # well marker style
在QGIS处理Python控制台中加载GeoTIFF水深测量图层:
python
iface.addRasterLayer("/path/to/bathymetry.tif", "Bathymetry")

3.2 Blender — Well Markers

3.2 Blender —— 油井标记

Generate a Blender Python script that positions well cylinders in 3D:
python
from digitalmodel.gis.integrations.blender_export import BlenderExporter
from digitalmodel.gis.layers.well_layer import WellLayer

layer = WellLayer.from_csv("wells.csv", lat_col="lat", lon_col="lon")
exporter = BlenderExporter(layer)
exporter.write_well_script("add_wells.py")
生成Blender Python脚本,在3D场景中放置油井柱体:
python
from digitalmodel.gis.integrations.blender_export import BlenderExporter
from digitalmodel.gis.layers.well_layer import WellLayer

layer = WellLayer.from_csv("wells.csv", lat_col="lat", lon_col="lon")
exporter = BlenderExporter(layer)
exporter.write_well_script("add_wells.py")

In Blender: Text editor > Open add_wells.py > Run Script

In Blender: Text editor > Open add_wells.py > Run Script

undefined
undefined

3.3 Blender — Terrain / Bathymetry Mesh

3.3 Blender —— 地形/水深测量网格

Convert a GeoTIFF to an OBJ mesh that Blender can import directly:
bash
python scripts/gis/geotiff-to-blender.py bathymetry.tif --output terrain.obj
将GeoTIFF转换为Blender可直接导入的OBJ网格:
bash
python scripts/gis/geotiff-to-blender.py bathymetry.tif --output terrain.obj

Optional: subsample to reduce vertex count

Optional: subsample to reduce vertex count

python scripts/gis/geotiff-to-blender.py bathymetry.tif --output terrain.obj --subsample 4

In Blender: **File > Import > Wavefront (.obj)** — select `terrain.obj`.

Scale defaults: 1 m = 0.001 Blender units (km scale). Override with
`--scale-xy` and `--scale-z`.
python scripts/gis/geotiff-to-blender.py bathymetry.tif --output terrain.obj --subsample 4

在Blender中:**文件 > 导入 > Wavefront (.obj)** —— 选择`terrain.obj`。

默认缩放比例:1米 = 0.001 Blender单位(千米级比例)。可通过`--scale-xy`和`--scale-z`参数覆盖。

3.4 QGIS — Import Terrain as CSV Point Cloud

3.4 QGIS —— 将地形作为CSV点云导入

bash
python scripts/gis/geotiff-to-blender.py bathymetry.tif --output points.csv
bash
python scripts/gis/geotiff-to-blender.py bathymetry.tif --output points.csv

QGIS: Layer > Add Layer > Add Delimited Text Layer > select points.csv

QGIS操作:图层 > 添加图层 > 添加分隔文本图层 > 选择points.csv

Set X=x, Y=y, Z=z, CRS = source CRS of the GeoTIFF

设置X=x、Y=y、Z=z,CRS = GeoTIFF的源CRS

undefined
undefined

3.5 worldenergydata.gis Module

3.5 worldenergydata.gis模块

python
undefined
python
undefined

Access BSEE well locations with CRS support

访问支持CRS的BSEE油井位置数据

from worldenergydata.bsee import load_wells wells_df = load_wells() # lat/lon columns in WGS84

---
from worldenergydata.bsee import load_wells wells_df = load_wells() # lat/lon columns in WGS84

---

4. Bathymetry Sources

4. 水深测量数据源

SourceResolutionFormatNotes
GEBCO 202315 arc-sec (~500 m)GeoTIFFGlobal, free download
GEBCO via GEEconfigurableGeoTIFF exportSee google-earth-engine skill
NOAA NCEI1 arc-sec (coastal US)GeoTIFFETOPO series

来源分辨率格式备注
GEBCO 202315角秒(约500米)GeoTIFF全球覆盖,可免费下载
GEBCO via GEE可配置GeoTIFF导出参见google-earth-engine技能
NOAA NCEI1角秒(美国沿海区域)GeoTIFFETOPO系列

5. digitalmodel.gis Module Map

5. digitalmodel.gis模块结构

digitalmodel/gis/
  coordinates.py          — CoordinatePoint dataclass, batch transforms
  core/
    crs.py                — CRS definitions, get_utm_epsg()
    geometry.py           — GeoPoint, GeoBoundingBox, GeoPolygon
    spatial_query.py      — radius, bbox, polygon, nearest-N queries
    coordinate_transformer.py
  io/
    geojson_handler.py    — GeoJSON read/write
    kml_handler.py        — KML/KMZ read/write
    shapefile_handler.py  — Shapefile (optional geopandas)
    geotiff_handler.py    — GeoTIFF read/write/to_xyz (optional rasterio)
  layers/
    feature_layer.py      — FeatureLayer (pandas-backed GIS collection)
    well_layer.py         — WellLayer (well-specific subclass)
  integrations/
    blender_export.py     — Blender script generator for well markers
    qgis_export.py        — QGIS .qgs project + .qml style generator
    folium_maps.py        — Folium/Leaflet HTML maps
    google_earth_export.py— Styled KML for Google Earth
    plotly_maps.py        — Plotly mapbox scatter/dashboard

digitalmodel/gis/
  coordinates.py          — CoordinatePoint dataclass, batch transforms
  core/
    crs.py                — CRS definitions, get_utm_epsg()
    geometry.py           — GeoPoint, GeoBoundingBox, GeoPolygon
    spatial_query.py      — radius, bbox, polygon, nearest-N queries
    coordinate_transformer.py
  io/
    geojson_handler.py    — GeoJSON read/write
    kml_handler.py        — KML/KMZ read/write
    shapefile_handler.py  — Shapefile (optional geopandas)
    geotiff_handler.py    — GeoTIFF read/write/to_xyz (optional rasterio)
  layers/
    feature_layer.py      — FeatureLayer (pandas-backed GIS collection)
    well_layer.py         — WellLayer (well-specific subclass)
  integrations/
    blender_export.py     — Blender script generator for well markers
    qgis_export.py        — QGIS .qgs project + .qml style generator
    folium_maps.py        — Folium/Leaflet HTML maps
    google_earth_export.py— Styled KML for Google Earth
    plotly_maps.py        — Plotly mapbox scatter/dashboard

6. Failure Diagnosis

6. 故障排查

ErrorCauseFix
ImportError: rasterio not installed
rasterio absent
pip install rasterio
CRS mismatch in spatial join
Layers in different CRS
gdf.to_crs("EPSG:32631")
OBJ mesh flipped Z in BlenderDepth values negativeUse
--scale-z -0.001
to invert
QGIS .qgs file not openingQGIS version mismatchOpen via Layer > Add Vector Layer instead
Large OBJ causes Blender slowdownFull-resolution rasterUse
--subsample 4
or higher
错误原因修复方案
ImportError: rasterio not installed
未安装rasterio
pip install rasterio
CRS mismatch in spatial join
图层使用的CRS不一致
gdf.to_crs("EPSG:32631")
OBJ mesh flipped Z in Blender深度值为负使用
--scale-z -0.001
参数反转数值
QGIS .qgs file not openingQGIS版本不匹配改用图层 > 添加矢量图层方式打开
Large OBJ causes Blender slowdown全分辨率栅格数据使用
--subsample 4
或更高的采样参数