Skip to content

Instantly share code, notes, and snippets.

View metasim's full-sized avatar
🎹

Simeon H.K. Fitch metasim

🎹
View GitHub Profile
import org.apache.spark.sql._
import org.apache.spark.sql.functions._
import org.locationtech.rasterframes._
import org.locationtech.rasterframes.datasource.raster._
import org.locationtech.rasterframes.encoders.CatalystSerializer._
import geotrellis.raster._
import geotrellis.vector.Extent
import org.locationtech.jts.geom.Point
object ValueAtPoint extends App {
_ogc_crs84 = 'urn:ogc:def:crs:OGC:1.3:CRS84'
_web_mercator_epsg = 'EPSG:3857'
def _meters_per_pixel(zoom: int, lat: float=0.0, tile_size:int=256) -> float:
"""
Return the pixel resolution for a given mercator tile zoom and lattitude.
:param zoom: Mercator zoom level
:param lat: Latitude in decimal degree. Optional (default: 0)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import org.apache.spark.sql.SparkSession
import geotrellis.raster._
import geotrellis.raster.gdal.GDALRasterSource
// implicit val spark = SparkSession.builder().
// master("local[*]").appName("Hit me").getOrCreate()
val path = "https://s22s-rasterframes-integration-tests.s3.amazonaws.com/B08.jp2"
spark.range(1000).rdd.
/*
* This software is licensed under the Apache 2 license, quoted below.
*
* Copyright 2020 Astraea, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* [http://www.apache.org/licenses/LICENSE-2.0]
/*
* This software is licensed under the Apache 2 license, quoted below.
*
* Copyright 2017 Astraea, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* [http://www.apache.org/licenses/LICENSE-2.0]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
java.lang.AssertionError: assertion failed: unsafe symbol Logger (child of package scalalogging) in runtime reflection universe
at scala.reflect.internal.Symbols$Symbol.<init>(Symbols.scala:184)
at scala.reflect.internal.Symbols$TypeSymbol.<init>(Symbols.scala:3009)
at scala.reflect.internal.Symbols$ClassSymbol.<init>(Symbols.scala:3201)
at scala.reflect.internal.Symbols$StubClassSymbol.<init>(Symbols.scala:3496)
at scala.reflect.internal.Symbols$Symbol.newStubSymbol(Symbols.scala:498)
at scala.reflect.internal.pickling.UnPickler$Scan.readExtSymbol$1(UnPickler.scala:258)
at scala.reflect.internal.pickling.UnPickler$Scan.readSymbol(UnPickler.scala:284)
at scala.reflect.internal.pickling.UnPickler$Scan.readSymbolRef(UnPickler.scala:649)
at scala.reflect.internal.pickling.UnPickler$Scan.readType(UnPickler.scala:417)
import geotrellis.raster.io.geotiff.SinglebandGeoTiff
import org.apache.spark.SparkFiles
import org.apache.spark.sql.SparkSession
import org.locationtech.rasterframes._
import org.locationtech.rasterframes.datasource.geotiff._
object LayerToGeoTiff {
def main(args: Array[String]): Unit = {
implicit val spark = new SparkSession.Builder()