Skip to content
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

Closed
wants to merge 5,643 commits into from

Conversation

miafg
Copy link
Contributor

@miafg miafg commented Nov 3, 2016

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

jpolchlo and others added 30 commits June 15, 2016 10:29
…spatial-example

Added example for translating from SpaceTimeKey to SpatialKey
…egistration

Remove the Kryo registration requirement
if (MultibandGeoTiff(path).tile.bandCount == 1) {
Left(SinglebandGeoTiff(path))
} else {
Right(MultibandGeoTiff(path))
Copy link
Contributor

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))
}

Copy link
Contributor

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 =
Copy link
Contributor

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

def apply(path: String): Either[SinglebandGeoTiff, MultibandGeoTiff] = {
val multiband = MultibandGeoTiff(path)
if (multiband.tile.bandCount == 1) {
Left(SinglebandGeoTiff(path))
Copy link
Member

@pomadchin pomadchin Nov 3, 2016

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)

@lossyrob lossyrob added this to the 1.1 milestone Nov 4, 2016
@echeipesh echeipesh dismissed pomadchin’s stale review November 9, 2016 19:54

Changes taken care of

@echeipesh echeipesh changed the title added to GeoTiff.scala to help new users undersand the structure Add convenience overloads to GeoTiff companion object Nov 9, 2016
@lossyrob lossyrob self-assigned this Nov 27, 2016
@lossyrob lossyrob removed this from the 1.1 milestone Mar 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.