-
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
GeoTiff Companion Object Methods #1757
Comments
I am looking at our documentation and it's a little sparse on this topic: https://github.com/geotrellis/geotrellis/blob/master/docs/raster/Geotiffs.md As part of this Issue there should be an addition to the docs that talks about and provides sample code:
This doesn't need be in-depth, just enough to give somebody an example and a flavor. |
I'm actually in the process of expanding/writing docs on some of the topics you suggested. Example: Reading GeoTiffs Locally |
@jbouffard Those are good docs. Since you were looking at his part of the API whats your opinion on the issue, does it seems like centralizing some common overloads around |
@echeipesh Thanks. Yeah, I think that centralizing the common overloads to a |
+1 to keeping the old overloads |
Fixed by #1840 |
A common pattern in scala to use companion object to provide constructor overloads for the base class. This is also convenient place to provide read constructors and in general decoders. An example can be seen here: https://github.com/geotrellis/geotrellis/blob/master/raster/src/main/scala/geotrellis/raster/io/geotiff/SinglebandGeoTiff.scala#L45
This API design/improvement issue.
In this particular case
SinglebandGeoTiff
is part of a type hierarchy withMultibandGeoTiff
where they both extendGeoTiff
interface. Because this distinction is forced by type structure of GeoTrellis and not really a distinction that users have in mind when working with GeoTiff files we would like to extend the companion overload pattern to theGeoTiff
super-type. That is:When working with GeoTiff (either singleband or multiband) there should be an apply on
GeoTiff
companion object that converts the arguments to eitherSinglebandGeoTiff
orMultibandGeoTiff
. When types are not enough to specify what is intended a method will need to have a unique name, such as for reading.For instance a String can be converted to a GeoTiff by reading the file:
GeoTiff.readSingleband(path: String): SinglebandGeoTiff
has the same parameter signature asGeoTiff.readMultiband(path: String): MultibandGeoTiff
, so therefore needs the name.Also
ProjectedRaster[T]
has enough information to be converted to a either aSinglebandGeoTiff
orMultibandGeotiff
. But in this case can be handled with an apply overload.The text was updated successfully, but these errors were encountered: