Skip to content

Add convenience overloads to GeoTiff companion object - #1774

Closed
miafg wants to merge 5643 commits into
locationtech:masterfrom
miafg:GeoTiffRefactor
Closed

miafg wants to merge 5643 commits into
locationtech:masterfrom
miafg:GeoTiffRefactor

Conversation

@miafg

@miafg miafg commented Nov 3, 2016 •

Copy link
Copy Markdown
Contributor

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

Justin Polchlopek 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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))

@pomadchin pomadchin Nov 3, 2016 •

Copy link
Copy Markdown
Member

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.