128 lines
4.9 KiB
Plaintext
128 lines
4.9 KiB
Plaintext
========================================
|
|
QGIS → S-57 Converter — Installation
|
|
========================================
|
|
|
|
REQUIRED: Python 3.9+
|
|
REQUIRED: GDAL with S-57 support
|
|
|
|
─────────────────────────────────────────
|
|
OPTION A: Windows — Easiest (OSGeo4W)
|
|
─────────────────────────────────────────
|
|
1. Download OSGeo4W: https://trac.osgeo.org/osgeo4w/
|
|
2. Run installer → Advanced Install → Select:
|
|
- gdal
|
|
- python3-gdal
|
|
- python3-geopandas (or install via pip)
|
|
3. Use the "OSGeo4W Shell" to run the converter:
|
|
cd "D:\Proyectos Software\QGISS57Converter"
|
|
python converter.py myproject.qgs
|
|
|
|
─────────────────────────────────────────
|
|
OPTION B: Conda / Mamba (Recommended)
|
|
─────────────────────────────────────────
|
|
conda create -n s57 python=3.11
|
|
conda activate s57
|
|
conda install -c conda-forge gdal geopandas
|
|
pip install lxml
|
|
cd "D:\Proyectos Software\QGISS57Converter"
|
|
python converter.py myproject.qgs
|
|
|
|
─────────────────────────────────────────
|
|
OPTION C: QGIS Python environment
|
|
─────────────────────────────────────────
|
|
QGIS already includes GDAL. Run from QGIS Python console:
|
|
import sys
|
|
sys.path.append(r"D:\Proyectos Software\QGISS57Converter")
|
|
from converter import convert
|
|
convert("myproject.qgs", None, None, False, True, True)
|
|
|
|
─────────────────────────────────────────
|
|
INSTALL other dependencies
|
|
─────────────────────────────────────────
|
|
pip install geopandas lxml pyproj
|
|
|
|
─────────────────────────────────────────
|
|
VERIFY installation
|
|
─────────────────────────────────────────
|
|
python -c "from osgeo import gdal; drv = gdal.GetDriverByName('S57'); print('S-57 driver:', drv.GetDescription() if drv else 'NOT AVAILABLE')"
|
|
|
|
========================================
|
|
USAGE
|
|
========================================
|
|
|
|
# List layers and their S-57 mapping:
|
|
python converter.py project.qgs --list
|
|
|
|
# Convert:
|
|
python converter.py project.qgs
|
|
|
|
# Custom output name:
|
|
python converter.py project.qgs --output CO1CO01M.000
|
|
|
|
# Custom config:
|
|
python converter.py project.qgs --config my_config.json
|
|
|
|
# No prompts (convert all mapped layers):
|
|
python converter.py project.qgs --force
|
|
|
|
========================================
|
|
LAYER NAMING — IMPORTANT
|
|
========================================
|
|
|
|
You have THREE options for mapping your QGIS layers to S-57:
|
|
|
|
OPTION 1 (easiest): Name your layers directly with S-57 acronyms
|
|
- Layer named "COALNE" → coastline
|
|
- Layer named "DEPARE" → depth area
|
|
- Layer named "SOUNDG" → soundings
|
|
See s57_objects.json for all available object classes.
|
|
|
|
OPTION 2: Name layers in Spanish or English (auto-detected)
|
|
- Layer named "costa" or "coastline" → auto → COALNE
|
|
- Layer named "fondos" or "batimetria" → auto → DEPARE
|
|
- Layer named "sondas" → auto → SOUNDG
|
|
See cell_config.json → "layer_mappings" for full list.
|
|
|
|
OPTION 3: Add custom mappings to cell_config.json
|
|
"layer_mappings": {
|
|
"mi_capa_costa": "COALNE",
|
|
"datos_profundidad": "DEPARE"
|
|
}
|
|
|
|
========================================
|
|
CELL NAMING CONVENTION (IHO S-57)
|
|
========================================
|
|
Format: CC1AA##X.000
|
|
CC = 2-letter country code (CO=Colombia, US=USA, etc.)
|
|
1 = Navigational Purpose (1=overview...6=berthing)
|
|
AA = 2-letter area code
|
|
## = serial number (01, 02...)
|
|
X = compilation scale indicator (M=medium)
|
|
|
|
Example: CO3CA01M.000 = Colombia, scale 1:50000, Caribbean area
|
|
|
|
Edit "cell_name" in cell_config.json accordingly.
|
|
|
|
========================================
|
|
COMMON S-57 OBJECT CLASSES
|
|
========================================
|
|
COALNE Coastline (lines)
|
|
LNDARE Land Area (polygons)
|
|
DEPARE Depth Area (polygons) — needs DRVAL1, DRVAL2 attributes
|
|
DEPCNT Depth Contour (lines) — needs VALDCO attribute
|
|
SOUNDG Soundings (points) — needs VALSOU (depth value) attribute
|
|
LIGHTS Lights (points)
|
|
BUOYLAT Lateral Buoy (points)
|
|
BCNLAT Lateral Beacon (points)
|
|
ACHARE Anchorage Area (polygons)
|
|
HRBARE Harbour Area (polygons)
|
|
BERTHS Berth (polygons/lines)
|
|
OBSTRN Obstruction (any)
|
|
WRECKS Wreck (polygons/points)
|
|
FAIRWY Fairway (polygons)
|
|
RESARE Restricted Area (polygons)
|
|
RIVERS River (polygons/lines)
|
|
M_COVR Coverage (polygons) — required in valid ENCs
|
|
|
|
See s57_objects.json for complete list.
|