Migrating to GeoTrellis 3.0¶
With the release of of GeoTrellis 3.0, some major API changes have occurred. This document seeks to go over these major changes, and how one can update their preexisting code to be compatible with 3.0.
Simplified Imports¶
One change brought about in 3.0 is the simplification of imports
in both the raster and vector packages. Before, it was not
uncommon to see files with a long list of imports such as this:
import geotrellis.vector._
import geotrellis.vector.io.wkb.WKB
import geotrellis.raster._
import geotrellis.raster.reproject._
import geotrellis.raster.resample.ResampleMethods
With the simplification of imports, the above is now:
import geotrellis.vector._
import geotrellis.raster._
This section will go over what is now available at the geotrellis.raster and
geotrellis.vector levels.
geotrellis.vector¶
The following implicits and types are now available in geotrellis.vector
- Implicits:
io.jsonio.wkbio.wkt
- Types:
io.wkb.WKBio.wkt.WKT
geotrellis.raster¶
These implicit methods can be used on Tiles, MultibandTiles,
TileFeature[T, D]s, Raster[T]s, or TileFeature[Raster[T], D]s.
- Implicits:
cropio.jsonmaskmergeprototypereprojectsplittransform
The following types and objects are now directly available at the
geotrellis.raster level.
- Types:
histogram.Histogram[T]histogram.MutableHistogram[T]histogram.StreamingHistogramhistogram.IntHistogramhistogram.DoubleHistogramrasterize.CellValuerender.ColorMaprender.ColorMapsrender.ColorRamprender.ColorRampsrender.RGBrender.RGBAresample.ResampleMethodmapalgebra.focal.Neighborhoodmapalgebra.focal.TargetCellstitch.Stitcher
In addition to the moved types and objects, new objects have been created to allow for easier access of certain types.
CropOptionsalias ofcrop.Crop.OptionsRasterizerOptionsalias ofrasterize.Rasterizer.OptionsColorMapOptionsalias ofrender.ColorMap.OptionsSplitOptionsalias ofsplit.Split.Options
Two enum objects have also been created in geotrellis.raster.
ResampleMethodsobject that contains all of the resample methods.Neighborhoodsobject that contains all of the neighborhoods.