Setup

Welcome to GeoTrellis, the Scala library for high-performance geographic data processing. Being a library, users import GeoTrellis and write their own Scala applications with it. This guide will help you get up and running with a basic GeoTrellis development environment.

Requirements

  • Java 8. GeoTrellis code won’t function with Java 7 or below. You can test your Java version by entering the following in a Linux or Mac terminal:
> javac -version
javac 1.8.0_102

You want to see 1.8 like above.

  • Apache Spark 2. This is if you plan to run ingests (as shown in our ETL tutorial) or write a serious application. Otherwise, fetching Spark dependencies for playing with GeoTrellis is handled automatically, as shown in our Quick-Start Guide.

When running more involved applications, spark-submit should be on your PATH:

> which spark-submit
/bin/spark-submit

Using Scala

GeoTrellis is a Scala library, so naturally you must write your applications in Scala. If you’re new to Scala, we recommend the following:

GeoTrellis Project Template

The geotrellis-sbt-template repo provides a simple GeoTrellis project template. It can be used to experiment with GeoTrellis, or to write full applications. Get it with:

git clone https://github.com/geotrellis/geotrellis-sbt-template.git

You don’t need sbt installed to write a GeoTrellis app, since this template includes an sbt bootstrap script. It is used like regular SBT, and comes with a few extra commands:

  • Enter the SBT shell: ./sbt
  • Run tests: ./sbt test
  • Force Scala 2.11 (default): ./sbt -211
  • Force Scala 2.10: ./sbt -210

À la Carte GeoTrellis Modules

GeoTrellis is actually a library suite made up of many modules. We’ve designed it such that you can depend on as much or as little of GeoTrellis as your project needs. To depend on a new module, add it to the libraryDependencies list in your build.sbt:

libraryDependencies ++= Seq(
    "org.locationtech.geotrellis" %% "geotrellis-spark"  % "1.0.0",
    "org.locationtech.geotrellis" %% "geotrellis-s3"     % "1.0.0", // now we can use Amazon S3!
    "org.apache.spark"            %% "spark-core"        % "2.1.0" % "provided",
    "org.scalatest"               %% "scalatest"         % "3.0.0" % "test"
)

Click here for a full list and explanation of each GeoTrellis module.

Now that you’ve gotten a simple GeoTrellis environment set up, it’s time to get your feet wet with some of its capabilities.