Open metasim opened 5 years ago
Would not be better just to have conversion (and other funcs) function properly implemented there?
@pomadchin You'd have to define convert
on Raster
or ProjectedRaster
which is of dubious value for weight.
Ah indeed; also read a lil bit wrong the issue from phone
I'd actually voice support for having at least mapTile
, which Raster
has:
def mapTile[A <: CellGrid](f: T => A): ProjectedRaster[A] = ....
At least that way you can get at convert
.
I uses convert
and interpretAs
enough that I wish they were on ProjectedRaster[T]
, but you'd have to context bound T
appropriately, and that does get heavy weight.
Anyone know what happens if you try to @deprecate
implicit conversions?
@metasim actually a good question: https://github.com/scala/bug/issues/10152 But probably would work as expected.
To followup from above, this is the use case I have a lot of time, especially when GeoTIFFs don't have the NoData
value properly set:
val pr = someGeotiff.projectedRaster
val tile = pr.tile.interpretAs(UShortConstantNoDataCellType)
val fixedpr = ProjectedRaster(tile, pr.extent, pr.crs)
@metasim
Welcome to Scala 2.11.12 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_162).
Type in expressions for evaluation. Or try :help.
scala> :paste
// Entering paste mode (ctrl-D to finish)
@deprecated("this method will be removed // dummy conversion", "GeoTrellis")
implicit def intToString(i: Int): String = i.toString
// Exiting paste mode, now interpreting.
intToString: (i: Int)String
scala> val str: String = 25
<console>:12: warning: method intToString is deprecated: this method will be removed // dummy conversion
val str: String = 25
^
str: String = 25
So how about we start off with just @deprecated
, and then in the next breaking release remove them?
It looks like 3.0 release is very close :D we can try to get it merged in
Testing it out now; works as advertised:
MultibandTilePolygonalSummaryHandler.scala:41:113: method featureToRaster in object Raster is deprecated: Implicit conversions considered unsafe
...
MatchingRasters.scala:56:33: method projectedToRaster in object ProjectedRaster is deprecated: Implicit conversions considered unsafe
Need to determine a better message tho...
To wit:
I suggest removing these:
https://github.com/locationtech/geotrellis/blob/cb39e0ba1f6d964b522dc3a194ff3fa24fd8efd2/raster/src/main/scala/geotrellis/raster/ProjectedRaster.scala#L38-L44
I also think the ones from tuples should go to, but the argument isn't as strong. Same for
Raster[T]
.Related: #1780, #2768