GeoTrellis is a geographic data processing engine for high performance applications.
dependabot[bot] on npm_and_yarn
Bump http-cache-semantics from … (compare)
dependabot[bot] on npm_and_yarn
Bump ua-parser-js from 0.7.28 t… (compare)
pomadchin on master
SBT Version up (compare)
pomadchin on master
fix the ci-release (compare)
pomadchin on master
ci-release test (compare)
pomadchin on master
skip s3-spark docs (compare)
pomadchin on master
rm the traget flag (compare)
pomadchin on master
replace the target flag (compare)
pomadchin on master
try compile before doc (compare)
pomadchin on master
sbt version downgrade (compare)
pomadchin on master
revert scala versions back (compare)
pomadchin on master
use sbt-extras in a containeriz… (compare)
pomadchin on master
use the tests image for the rel… (compare)
def createSinglebandTileJson(input: String, output: String, layerName: String): Unit = {
val maskJson: String =
"""
|[
| {
| "uri" : "{input}",
| "time_tag" : "TIFFTAG_DATETIME",
| "time_format" : "yyyy:MM:dd HH:mm:ss",
| "type" : "singleband.spatial.read.hadoop"
| },
| {
| "resample_method" : "nearest-neighbor",
| "type" : "singleband.spatial.transform.tile-to-layout"
| },
| {
| "crs" : "EPSG:3857",
| "scheme" : {
| "crs" : "epsg:3857",
| "tileSize" : 256,
| "resolutionThreshold" : 0.1
| },
| "resample_method" : "nearest-neighbor",
| "type" : "singleband.spatial.transform.buffered-reproject"
| },
| {
| "end_zoom" : 0,
| "resample_method" : "nearest-neighbor",
| "type" : "singleband.spatial.transform.pyramid"
| },
| {
| "name" : "{layerName}",
| "uri" : "{output}",
| "key_index_method" : {
| "type" : "zorder",
| "temporal_resolution": 1
| },
| "scheme" : {
| "crs" : "epsg:3857",
| "tileSize" : 256,
| "resolutionThreshold" : 0.1
| },
| "type" : "singleband.temporal.write"
| }
|]
""".stripMargin
val maskJsonStr = maskJson.replace("{input}", input).replace("{output}", output).replace("{layerName}", layerName)
val list: Option[Node[Stream[(Int, TileLayerRDD[SpaceTimeKey])]]] = maskJsonStr.node
list match {
case None => println("Couldn't parse the JSON")
case Some(node) => {
node.eval.foreach { case (zoom, rdd) =>
println(s"ZOOM: ${zoom}")
println(s"COUNT: ${rdd.count}")
}
}
}
def createSinglebandTileJson(input: String, output: String, layerName: String): Unit = {
val maskJson: String =
"""
|[
| {
| "uri" : "{input}",
| "time_tag" : "TIFFTAG_DATETIME",
| "time_format" : "yyyy:MM:dd HH:mm:ss",
| "type" : "singleband.spatial.read.hadoop"
| },
| {
| "resample_method" : "nearest-neighbor",
| "type" : "singleband.spatial.transform.tile-to-layout"
| },
| {
| "crs" : "EPSG:3857",
| "scheme" : {
| "crs" : "epsg:3857",
| "tileSize" : 256,
| "resolutionThreshold" : 0.1
| },
| "resample_method" : "nearest-neighbor",
| "type" : "singleband.spatial.transform.buffered-reproject"
| },
| {
| "end_zoom" : 0,
| "resample_method" : "nearest-neighbor",
| "type" : "singleband.spatial.transform.pyramid"
| },
| {
| "name" : "{layerName}",
| "uri" : "{output}",
| "key_index_method" : {
| "type" : "zorder",
| "temporal_resolution": 1
| },
| "scheme" : {
| "crs" : "epsg:3857",
| "tileSize" : 256,
| "resolutionThreshold" : 0.1
| },
| "type" : "singleband.temporal.write"
| }
|]
""".stripMargin
val maskJsonStr = maskJson.replace("{input}", input).replace("{output}", output).replace("{layerName}", layerName)
val list: Option[Node[Stream[(Int, TileLayerRDD[SpaceTimeKey])]]] = maskJsonStr.node
list match {
case None => println("Couldn't parse the JSON")
case Some(node) => {
node.eval.foreach { case (zoom, rdd) =>
println(s"ZOOM: ${zoom}")
println(s"COUNT: ${rdd.count}")
}
}
}
}
singleband.temporal.read.hadoop
LayerUpdater
Hello! I am currently trying to get GeoTrellis to work in Databricks, but I am facing some issue(s). I have installed geotrellis-spark and geotrellis-raster (versions 3.6.0) from the Databrick's UI through Maven. I have the following code:import geotrellis.raster._
import geotrellis.spark._
import geotrellis.raster.io.geotiff._
val rasterFilePath = "path/to/my.tif"
val geoTiff = GeoTiffReader.readSingleband(rasterFilePath)
But I'm getting java.lang.NoClassDefFoundError: Could not initialize class geotrellis.raster.io.geotiff.TiffType$ error
. I noticed that someone else had this problem here before, but unfortunately the solution was never posted here. Any clues what I'm doing wrong here?
hey @pomadchin I'm sorry but I'm still having some trouble with my mosaic task :( . I wrote this starting from your suggestion:
val firstTiff = GeoTiffReader
.readSingleband("...")
val combinedExtent = firstExtent.expandToInclude(secondExtent)
val re = RasterExtent(combinedExtent, firstTiff.cellSize)
val newRaster = Raster(ArrayTile.alloc(firstTiff.cellType, re.cols, re.rows), re.extent)
val mergedRaster = newRaster.merge(Raster(firstRaster.tile, firstExtent))
I can't understand why but the merge
function with that configuration is not resolved. I tried with other two rasters read form files and the function is correctly resolved. The only difference I noticed between the created raster and the read ones is that the geotrellis.raster.DoubleUserDefinedNoDataArrayTile
produces a merge
while the read raster have a inner geotrellis.raster.io.geotiff.Float64GeoTiffTile
. Did I mess up something with imports and packages?
Thanks in advance
hey @santocp94 what to you mean by not correctly resolved?
I tried with different configurations but an error occurred:
value merge is not a member of geotrellis.raster.Raster[geotrellis.raster.MutableArrayTile]
or
value merge is not a member of geotrellis.raster.Raster[geotrellis.raster.ArrayTile]
withMultibandRasterMergeMethod(raster).merge
works
Exception in thread "main" java.lang.ClassCastException: class geotrellis.raster.DoubleUserDefinedNoDataArrayTile cannot be cast to class geotrellis.raster.MultibandTile
withMultibandRasterMergeMethod
. I also tried to re-import everything from scratch but the problem persists
import geotrellis.raster._
should be able to get it into the scope
geotrellis.raster.merge.Implicits._
but I can recommend it only for test / dev purposes
@epursiai just create an uber jar and shade them; check out https://github.com/sbt/sbt-assembly#shading
we usually use sbt-assembly plugin for these purposes; The example of usage in the gt build code is here https://github.com/locationtech/geotrellis/blob/master/project/Settings.scala#L559-L569
So in your case along with the circe rule you would need shapeless and cats kernel shading:
ShadeRule.rename("io.circe.**" -> s”$shadePackage.io.circe.@1").inAll
ShadeRule.rename("shapeless.**" -> s"$shadePackage.shapeless.@1").inAll,
ShadeRule.rename("cats.kernel.**" -> s"$shadePackage.cats.kernel.@1").inAll
$ sbt
$ project example
$ // run