Package: geospade
geospadeDescriptiongeospadestands forgeospatialabstractdefinitionenvironment.
It serves as place to define classes and properties of raster and vector geometries and their operations alike.
On a higher level, abstract definitions should be embedded in a geospatial context to support interaction with other Python packages, e.g.gdal,geopandasorxarray.
In comparison to these Python packages,geospadenever touches or writes any geospatial data on disk.
It is a toolkit for geospatial entities (e.g., points, polygons, ...) and their relations (e.g., intersection, within, ...) in a spatial reference system (e.g., reprojection, mosaics, ...).Ingeospadea geospatial context is given by the spatial reference system classcrs.SpatialRef, which allows to convert between different spatial reference definitions in Python (e.g.,osr,cartopy.crs, ...) and offers well-known spatial reference system representations, i.e. WKT, PROJ4, and EPSG.
It aims to solve discrepancies between these representations and lower-level package versions, e.g.gdal.An abstract, geospatial definition of a raster is implemented inRasterGeometry.
It is constructed by providing a pixel extent, i.e. the number of rows and columns, the 6 affine geotransformation parameters and a spatial reference system.
With this knowledge, one can use aRasterGeometryinstance to do many operations, e.g. intersect it with geometries, transform between pixel and spatial reference system coordinates, resize it, or interact with other raster geometries.Often, geospatial image data is available in tiled or gridded format due to storage/memory limits.
To preserve the spatial relationship for each image,MosaicGeometrycan help to apply geospatial operations across image/tile boundaries.
It represents a simple collection ofTile/RasterGeometryinstances, where eachTiledescribes the spatial properties of an image.
With this setup, tile relations and neighbourhoods can be derived.InstallationThe package can be either installed via pip or if you solely want to work withgeospadeor contribute, we recommend to
install it as a conda environment. If you work already with your own environment, please have look atconda_environment.ymland install/adapt missing packages.pipTo installgeospadevia pip in your own environment, use:pip install geospadecondaThe packages also comes along with a conda environmentconda_environment.yml.
This is especially recommended if you want to contribute to the project.
The following script will install miniconda and setup the environment on a UNIX
like system. Miniconda will be installed into$HOME/miniconda.wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
conda env create -f conda_env.yml
source activate geospadeThis script adds$HOME/miniconda/bintemporarily to thePATHto do this
permanently addexport PATH="$HOME/miniconda/bin:$PATH"to your.bashrcor.zshrc.For Windows, use the following setup:Download the latestminiconda 3 installerfor WindowsClick on.exefile and complete the installation.Add the foldercondabinfolder to your environment variablePATH.
You can find thecondabinfolder usually under:C:\Users\username\AppData\Local\Continuum\miniconda3\condabinFinally, you can set up the conda environment via:conda env create -f conda_environment.yml
source activate geospadeAfter that you should be able to runpython setup.py testto run the test suite orpython setup.py installto installgeospade.ContributionWe are happy if you want to contribute. Please raise an issue explaining what
is missing or if you find a bug. We will also gladly accept pull requests
against our master branch for new features or bug fixes.
If you want to contribute please follow these steps:Fork thegeospaderepository to your accountClone thegeospaderepositoryMake a new feature branch from thegeospademaster branchAdd your featurePlease include tests for your contributions in one of the test directories.
We usepy.testso a simple function calledtest_my_featureis enoughSubmit a pull request to our master branch