Dieser Abschnitt listet Open-Source-Pakete für die Manipulation von Geodatendateien mit Python auf. Die notwendigen Pakete sind bereits installiert flusstools]. Darüber hinaus enthalten die folgenden Absätze Erläuterungen zu relevanten und optionalen Paketen für dieses eBook und wie diese installiert werden können.
Watch this Section on YouTube
Watch this section as a video on the @hydroinformatics channel on YouTube.
OSGeo und GDAL Einschließlich ogr und osr¶
Die gdal-Bibliothek für raster data handling kommt zusammen mit ogr für vector data handling und osr für Georeferenzierung]. GDAL und OGR werden von OSGeo Project] verwaltet und entwickelt, das Teil der Open Source Geospatial Foundation ist - den Entwicklern von QGIS.
The tutorials in this eBook build on gdal and ogr (including osr for spatial referencing), which is why it is important to get the installation of GDAL right:
Linux-Benutzer können die Anweisungen zur Installation von
gdalund flusstools mit pip and venv] befolgen.Windows-Benutzer installieren vorzugsweise
gdalund flusstools in einem conda environment über Anaconda].
Wählen Sie Ihre Plattform für spezifischere Installationsanweisungen:
GDAL requires sudo-installation. Find more details in the Python installation instructions of this eBook.
Um GDAL für Python über Anaconda Prompt zu installieren, geben Sie an:
conda install -c conda-forge gdalGeojson¶
Die geojson-Bibliothek ist die direkteste Option für den Umgang mit GeoJSON-Daten und ist auch bereits zusammen mit flusstools] installiert.
Um geojson zu installieren, öffnen Sie *Terminal * und geben Sie ein:
pip install geojsonUm geojson für Python Anaconda zu installieren, öffnen Sie Anaconda Prompt und geben Sie ein:
conda install -c conda-forge geojsonDescartes Labs¶
Even though of proprietary origin, the descarteslabs library (developed and maintained by Descartes Labs) comes with many open-sourced functions. Moreover, Descartes Labs hosts the showcase platform GeoVisual Search with juicy illustrations of artificial intelligence (AI) applications in geoscience. Note that descarteslabs is not installed along with flusstools.
To install descarteslabs, open Terminal and type:
pip install descarteslabsUm descarteslabs für Python zu installieren, öffnen Sie Anaconda Prompt und geben Sie ein:
conda install -c conda-forge descartesWenn die Installation fehlschlägt, versuchen Sie Folgendes:
conda install shapely
pip install descarteslabsPython Imaging Library (PIL) / Kissen¶
Processing images with Python is enabled with the Python Imaging Library (PIL). PIL supports many image file formats and has efficient graphics processing capabilities. The pillow library is a user-friendly PIL fork and provides Image* modules (e.g., Image, ImageDraw, ImageMath, and many more). If flusstools is installed, no further action is required for working with the PIL/pillow-related contents of this eBook.
Note that the conda base environment includes PIL (test with import PIL), which needs to be uninstalled before installing pillow. For installing PIL/pillow, refer to https://
Formgebung¶
A preferable and very well documented package for Shapefil handling is shapely. shapely is already installed along with flusstools.
To install shapely, open Terminal and type:
pip install ShapelyUm shapely für Python Anaconda zu installieren, öffnen Sie Anaconda Prompt und geben Sie ein:
conda install -c conda-forge shapelypyshp¶
pyshp ist ein weiteres shapefile-Handling-Paket, das auf reinem Python-Code (anstatt Wrappern) aufbaut, um den direkten Umgang mit Shapefiles in Python zu vereinfachen.] pyshp ist bereits zusammen mit flusstools] installiert.
To install pyshp, open Terminal and type:
pip install pyshpUm pyshp für Python Anaconda zu installieren, öffnen Sie Anaconda Prompt und geben Sie ein:
conda install -c conda-forge pyshpAndere Verpackungen¶
Neben den oben genannten Paketen gibt es weitere nützliche Bibliotheken für Geodatenanalysen mit Python (Packages in bold red font werden zusammen mit flusstools] installiert):
alphashape] erzeugt begrenzende Polygone, die eine Reihe von Punkten enthalten.django] als geografischer Webframe und für Datenbankverbindungen.
geopandas] ermöglicht die Anwendung von Pandas-Datenrahmenoperationen auf Geodatensätze.NetworkX für Netzwerkanalysen wie das Finden eines kostengünstigsten / kürzesten Pfades zwischen zwei Punkten].
owslib zur Verbindung mit den Webdiensten des Open Geospatial Consortium (OGC).
postgresql für SQL-Datenbankverbindungen].
rasterio] für die Verarbeitung von Rasterdaten als NumPy-Arrays.rasterstatserzeugt zonale Statistiken von Rastern und kann mit GeoJSON-Dateien interagieren.]sckit-image] für maschinelles Lernen, das auf georeferenzierte Bilder angewendet wird.