Skip to content

Instantly share code, notes, and snippets.

@lossyrob
lossyrob / BoxingBenchmark.scala
Last active August 29, 2015 14:19
Benchmarking the boxing of Function3
package geotrellis.benchmark
import geotrellis.vector._
import geotrellis.raster._
import geotrellis.raster.op.local._
import com.google.caliper.Param
import scala.util.Random
import scala.annotation.tailrec
@lossyrob
lossyrob / jpeg-decompress-start.scala
Created April 16, 2015 02:15
Johan's first stab at a JPEG decompressor. Didn't get too far, but wanted to keep the code around just..in case.
package geotrellis.raster.io.geotiff.reader.decompression
import geotrellis.raster.io.geotiff.reader._
import geotrellis.raster.io.geotiff.reader.tags.Tags
import java.nio.{ByteBuffer, ByteOrder}
import monocle.syntax._
import spire.syntax.cfor._
@lossyrob
lossyrob / geotrellis-geotiff-refactor-benchmark-results.md
Last active August 29, 2015 14:19
Benchmark results between GeoTrellis pre-refactor GeoTiff reader and post-refactor GeoTiff reader.

Bit rasters

[info] Running geotrellis.benchmark.ReadAspectBitUncompressedStriped 
[info]  0% Scenario{vm=java, trial=0, benchmark=NativeReadAspectTif} 4605736.18 ns; σ=183873.35 ns @ 10 trials
[info] 50% Scenario{vm=java, trial=0, benchmark=NewReadAspectTif} 19903200.00 ns; σ=128275.29 ns @ 3 trials
[info] 
[info]           benchmark    ms linear runtime
[info] NativeReadAspectTif  4.61 ======
[info]    NewReadAspectTif 19.90 ==============================
@lossyrob
lossyrob / OrientationConverter.scala
Created April 23, 2015 17:08
OrientationConverter from Johan's GeoTiff code.
/*
* Copyright (c) 2014 Azavea.
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
@lossyrob
lossyrob / parse.py
Created May 14, 2015 21:08
Python script to parse GeoTrellis benchmarks. python parse.py *.out
from collections import namedtuple
import re, sys
import csv
import os
from tempfile import mkdtemp
from zipfile import ZipFile
import os.path
def parse_file(filepath):
@lossyrob
lossyrob / core-site.xml
Created May 22, 2015 18:17
Hadoop Configuraiton for local GeoTrellis/Spark development
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:8020</value>
</property>
<property>
<name>fs.trash.interval</name>
@lossyrob
lossyrob / accumulo-env.sh
Created May 22, 2015 18:43
Accumulo configuration for local Geotrellis/Spark environment
#! /usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
@lossyrob
lossyrob / install-geotrellis-spark-dev.md
Created May 26, 2015 02:12
Install Geotrellis enabled Spark development environment
@lossyrob
lossyrob / oam-server-scope.md
Created June 11, 2015 18:18
OAM Server Scope

Web services - Runs locally on one machine or on AWS

Data validation and metadata generation

  • Request (JSON):
  • Includes imagery to be processed -Includes metadata that can’t be read out of the image.
  • Action:
  • Validate each image file
  • Generate metadata json for each imagery if set is valid.
  • Overwrites any existing metadata.
@lossyrob
lossyrob / read-school-json.scala
Created July 1, 2015 17:41
Reading school data points as PointFeature[Int] in GeoTrellis 0.10
// Find the data here: https://www.opendataphilly.org/dataset/schools/resource/b29d98a9-6b96-4742-aedc-80cac6398d1a
import scala.io._
import geotrellis.vector._
import geotrellis.vector.io.json._
import spray.json._
// { "OBJECTID": 1, "AUN": 126515001, "SCHOOL_NUM": 3712, "LOCATION_ID": "6250", "FACIL_NAME": "Henry, Charles W.", "FACILNAME_LABEL": "Henry, Charles W.", "FACIL_ADDRESS": "601 Carpenter La.", "ZIPCODE": "19119 - 3405", "FACIL_TELEPHONE": "951-4006", "ACTIVE": "Open", "GRADE_LEVEL": "Elem\/Middle", "GRADE_ORG": "K-8", "ENROLLMENT": 478, "TYPE": "District", "TYPE_SPECIFIC": "District", "GlobalID": "1eea0c90-80c1-4cd2-a8e6-40ea9973ea35" }
case class SchoolData(enrollment: Int)