-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add convenience overloads to GeoTiff companion object #1774
Conversation
Refactors to KernelDensity.
…spatial-example Added example for translating from SpaceTimeKey to SpatialKey
…t tags to read, updated docs
…egistration Remove the Kryo registration requirement
…by already runing jobs on a runing cluster
…n/geotrellis into feature/collections-api # Conflicts: # accumulo/src/main/scala/geotrellis/spark/io/accumulo/AccumuloCollectionReader.scala
…-api-njoin Feature/collections api njoin
…ns-api Collections API
if (MultibandGeoTiff(path).tile.bandCount == 1) { | ||
Left(SinglebandGeoTiff(path)) | ||
} else { | ||
Right(MultibandGeoTiff(path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you're potentially reading the file twice
} else { | ||
Right(MultibandGeoTiff(path)) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also should have overloads to build a GeoTiff from ProjectedTile
def readMultiBand(path: String): MultibandGeoTiff = | ||
MultibandGeoTiff(path) | ||
|
||
def readSingleBand(path: String): SinglebandGeoTiff = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be readSingleband
(lower case b) to be consistent with methods on the readers
…r MultibandGeoTiff
def apply(path: String): Either[SinglebandGeoTiff, MultibandGeoTiff] = { | ||
val multiband = MultibandGeoTiff(path) | ||
if (multiband.tile.bandCount == 1) { | ||
Left(SinglebandGeoTiff(path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
You don't actually need to read tiff from the source path again as you already read geotiff into memory using MultibandGeoTiff(path)
:
new SinglebandGeoTiff(multiband.tile.band(0), multiband.extent, multiband.crs, multiband.tags, multiband.options)
f56000c
to
e0b98d9
Compare
Add a method to GeoTiff.scala so that users can create GeoTiff objects without knowing whether they want a multiband or singleband geotiff. Also added functions to allow users to read multiband or singleband files without having a Multiband or Singleband Geotiff object.
Fixes #1757