Skip to content

Instantly share code, notes, and snippets.

@pomadchin
Last active August 4, 2024 19:04
Show Gist options
  • Save pomadchin/63ba75dd659dc03cc2502400e361e7d8 to your computer and use it in GitHub Desktop.
Save pomadchin/63ba75dd659dc03cc2502400e361e7d8 to your computer and use it in GitHub Desktop.
GeoTrellis quickstart
val scala213 = "2.13.14"
name := "geotrellis-hdfs-example"
version := "0.1.0-SNAPSHOT"
scalaVersion := scala213
organization := "com.pomadchin"
scalacOptions ++= Seq(
"-deprecation",
"-unchecked",
"-language:implicitConversions",
"-language:reflectiveCalls",
"-language:higherKinds",
"-language:postfixOps",
"-language:existentials",
"-feature"
)
resolvers ++= Resolver.sonatypeOssRepos("releases") ++ Resolver.sonatypeOssRepos("snapshots")
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % "3.5.1",
"org.apache.hadoop" % "hadoop-client" % "3.3.6",
"org.locationtech.geotrellis" %% "geotrellis-spark" % "3.7.1"
)
package com.pomadchin
import geotrellis.raster.RasterSource
import geotrellis.vector.Extent
object Main {
// https://github.com/locationtech/geotrellis/blob/master/raster/data/one-month-tiles-tiff/test-200506000000_0_1.tiff
// ./bin/hadoop fs -copyFromLocal ~/Downloads/test-200506000000_0_1.tiff /test-200506000000_0_1.tiff
def main(args: Array[String]): Unit =
RasterSource("hdfs://localhost:9000/test-200506000000_0_1.tiff")
.read(Extent(-120, 45, -116, 49))
.foreach(println)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment