{"action":"created","comment":{"url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/comments/76897001","id":76897001,"diff_hunk":"@@ -0,0 +1,253 @@\n+package geotrellis.spark.io.geowave\n+\n+import geotrellis.geotools._\n+import geotrellis.proj4.LatLng\n+import geotrellis.raster._\n+import geotrellis.spark._\n+import geotrellis.spark.io._\n+import geotrellis.spark.io.accumulo._\n+import geotrellis.spark.io.avro._\n+import geotrellis.spark.io.index.KeyIndex\n+import geotrellis.util._\n+import geotrellis.vector.Extent\n+\n+import com.typesafe.scalalogging.slf4j._\n+import mil.nga.giat.geowave.adapter.raster.adapter.merge.RasterTileRowTransform\n+import mil.nga.giat.geowave.adapter.raster.adapter.RasterDataAdapter\n+import mil.nga.giat.geowave.core.geotime.ingest._\n+import mil.nga.giat.geowave.core.store._\n+import mil.nga.giat.geowave.core.store.adapter.statistics.StatsCompositionTool\n+import mil.nga.giat.geowave.core.store.data.VisibilityWriter\n+import mil.nga.giat.geowave.core.store.operations.remote.options.DataStorePluginOptions\n+import mil.nga.giat.geowave.core.store.util.DataStoreUtils\n+import mil.nga.giat.geowave.datastore.accumulo._\n+import mil.nga.giat.geowave.datastore.accumulo.metadata._\n+import mil.nga.giat.geowave.datastore.accumulo.operations.config.AccumuloOptions\n+import mil.nga.giat.geowave.datastore.accumulo.util._\n+import mil.nga.giat.geowave.datastore.accumulo.util.AccumuloUtils\n+import org.apache.accumulo.core.client.security.tokens.PasswordToken\n+import org.apache.accumulo.core.data.{ Key, Value }\n+import org.apache.spark.rdd.RDD\n+import org.apache.spark.SparkContext\n+import org.geotools.coverage.grid.GridCoverage2D\n+import org.geotools.coverage.processing.CoverageProcessor\n+import org.geotools.factory.{ GeoTools, Hints }\n+import org.opengis.coverage.grid.GridCoverage\n+import org.opengis.parameter.ParameterValueGroup\n+\n+import java.io.{ DataInputStream, DataOutputStream, File }\n+import java.util.UUID\n+import javax.imageio.ImageIO\n+import javax.media.jai.{ ImageLayout, JAI }\n+import scala.collection.JavaConversions._\n+import scala.collection.mutable.ListBuffer\n+import scala.reflect._\n+\n+import resource._\n+import spray.json._\n+\n+\n+object GeowaveLayerWriter extends LazyLogging {\n+\n+  def write[\n+    K: ClassTag,\n+    V: ClassTag,\n+    M: JsonFormat: GetComponent[?, Bounds[K]]\n+  ](\n+    coverageName: String,\n+    rdd: RDD[(K, V)] with Metadata[M],\n+    as: GeowaveAttributeStore,\n+    accumuloWriter: AccumuloWriteStrategy\n+  ): Unit = {\n+    val metadata = implicitly[ClassTag[K]].toString match {\n+      case \"geotrellis.spark.SpatialKey\" => rdd.metadata.asInstanceOf[TileLayerMetadata[SpatialKey]]\n+      case t: String => throw new Exception(s\"Unsupported Key Type: $t\")\n+    }\n+\n+    val crs = metadata.crs\n+    val mt = metadata.mapTransform\n+    val cellType = metadata.cellType.toString\n+    val specimen = rdd.first\n+\n+    /* Construct (Multiband|)Tile to GridCoverage2D conversion function */\n+    val geotrellisKvToGeotools: (((K, V)) => GridCoverage2D) = {\n+      specimen match {\n+        case (_: SpatialKey, _: Tile) => {\n+          case (k: K, v: V) =>\n+            val extent = mt(k.asInstanceOf[SpatialKey]).reproject(crs, LatLng)\n+            val tile = v.asInstanceOf[Tile]\n+            ProjectedRaster(Raster(tile, extent), LatLng).toGridCoverage2D\n+        }\n+        case (_: SpatialKey, _: MultibandTile) => {\n+          case (k: K, v: V) =>\n+            val extent = mt(k.asInstanceOf[SpatialKey]).reproject(crs, LatLng)\n+            val tile = v.asInstanceOf[MultibandTile]\n+            ProjectedRaster(Raster(tile, extent), LatLng).toGridCoverage2D\n+        }\n+      }\n+    }","path":"geowave/src/main/scala/geotrellis/spark/io/geowave/GeowaveLayerWriter.scala","position":88,"original_position":88,"commit_id":"5faa27c949f6b214aeec33b3480538aba5d4bdef","original_commit_id":"5faa27c949f6b214aeec33b3480538aba5d4bdef","user":{"login":"lossyrob","id":2320142,"avatar_url":"https://avatars.githubusercontent.com/u/2320142?v=3","gravatar_id":"","url":"https://api.github.com/users/lossyrob","html_url":"https://github.com/lossyrob","followers_url":"https://api.github.com/users/lossyrob/followers","following_url":"https://api.github.com/users/lossyrob/following{/other_user}","gists_url":"https://api.github.com/users/lossyrob/gists{/gist_id}","starred_url":"https://api.github.com/users/lossyrob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lossyrob/subscriptions","organizations_url":"https://api.github.com/users/lossyrob/orgs","repos_url":"https://api.github.com/users/lossyrob/repos","events_url":"https://api.github.com/users/lossyrob/events{/privacy}","received_events_url":"https://api.github.com/users/lossyrob/received_events","type":"User","site_admin":false},"body":"This also will throw on anything but `Tile` and `MultibandTile`. If we need to restrict types, we'll have to do it via the type system","created_at":"2016-08-30T23:11:11Z","updated_at":"2016-08-30T23:11:11Z","html_url":"https://github.com/geotrellis/geotrellis/pull/1542#discussion_r76897001","pull_request_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1542","_links":{"self":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/comments/76897001"},"html":{"href":"https://github.com/geotrellis/geotrellis/pull/1542#discussion_r76897001"},"pull_request":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1542"}}},"pull_request":{"url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1542","id":73453230,"html_url":"https://github.com/geotrellis/geotrellis/pull/1542","diff_url":"https://github.com/geotrellis/geotrellis/pull/1542.diff","patch_url":"https://github.com/geotrellis/geotrellis/pull/1542.patch","issue_url":"https://api.github.com/repos/geotrellis/geotrellis/issues/1542","number":1542,"state":"open","locked":false,"title":"Create GeoWave Subproject","user":{"login":"jamesmcclain","id":11281373,"avatar_url":"https://avatars.githubusercontent.com/u/11281373?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesmcclain","html_url":"https://github.com/jamesmcclain","followers_url":"https://api.github.com/users/jamesmcclain/followers","following_url":"https://api.github.com/users/jamesmcclain/following{/other_user}","gists_url":"https://api.github.com/users/jamesmcclain/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesmcclain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesmcclain/subscriptions","organizations_url":"https://api.github.com/users/jamesmcclain/orgs","repos_url":"https://api.github.com/users/jamesmcclain/repos","events_url":"https://api.github.com/users/jamesmcclain/events{/privacy}","received_events_url":"https://api.github.com/users/jamesmcclain/received_events","type":"User","site_admin":false},"body":"These changes add a GeoWave subproject, which includes a `GeowaveAttributeStore`, `GeowaveLayerReader`, and `GeowaveLayerWriter`.\r\n\r\n   - [x] Missing metadata exception\r\n   - [x] Reduction or elimination of use of `asInstanceOf`\r\n   - [x] Fix `geotools` Tests\r\n   - [x] Find work-arounds for bugs\r\n   - [x] Unit Tests\r\n   - [x] `GridCoverage2D` Kryo Serializer\r\n\r\nTests can be run locally and they pass, but there appears to be [insufficient memory to bring up GeoWave on Travis](https://travis-ci.org/geotrellis/geotrellis/builds/155751339):\r\n```\r\nOpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000768680000, 51904512, 0) failed; error='Cannot allocate memory' (errno=12)\r\n#\r\n# There is insufficient memory for the Java Runtime Environment to continue.\r\n# Native memory allocation (malloc) failed to allocate 51904512 bytes for committing reserved memory.\r\n# An error report file with more information is saved as:\r\n# /home/travis/build/geotrellis/geotrellis/hs_err_pid4764.log\r\n+exit 1\r\nThe command \".travis/build-and-test.sh\" exited with 1.\r\ncache.2\r\nstore build cache\r\n0.00s\r\n2.98snothing changed, not updating cache\r\nDone. Your build exited with 1.\r\n```\r\n","created_at":"2016-06-11T00:42:15Z","updated_at":"2016-08-30T23:11:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b02116d0df2bb96ab46a30771faf2d7767702743","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1542/commits","review_comments_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1542/comments","review_comment_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/comments{/number}","comments_url":"https://api.github.com/repos/geotrellis/geotrellis/issues/1542/comments","statuses_url":"https://api.github.com/repos/geotrellis/geotrellis/statuses/5faa27c949f6b214aeec33b3480538aba5d4bdef","head":{"label":"jamesmcclain:feature/jwm/GeoWave","ref":"feature/jwm/GeoWave","sha":"5faa27c949f6b214aeec33b3480538aba5d4bdef","user":{"login":"jamesmcclain","id":11281373,"avatar_url":"https://avatars.githubusercontent.com/u/11281373?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesmcclain","html_url":"https://github.com/jamesmcclain","followers_url":"https://api.github.com/users/jamesmcclain/followers","following_url":"https://api.github.com/users/jamesmcclain/following{/other_user}","gists_url":"https://api.github.com/users/jamesmcclain/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesmcclain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesmcclain/subscriptions","organizations_url":"https://api.github.com/users/jamesmcclain/orgs","repos_url":"https://api.github.com/users/jamesmcclain/repos","events_url":"https://api.github.com/users/jamesmcclain/events{/privacy}","received_events_url":"https://api.github.com/users/jamesmcclain/received_events","type":"User","site_admin":false},"repo":{"id":47411065,"name":"geotrellis","full_name":"jamesmcclain/geotrellis","owner":{"login":"jamesmcclain","id":11281373,"avatar_url":"https://avatars.githubusercontent.com/u/11281373?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesmcclain","html_url":"https://github.com/jamesmcclain","followers_url":"https://api.github.com/users/jamesmcclain/followers","following_url":"https://api.github.com/users/jamesmcclain/following{/other_user}","gists_url":"https://api.github.com/users/jamesmcclain/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesmcclain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesmcclain/subscriptions","organizations_url":"https://api.github.com/users/jamesmcclain/orgs","repos_url":"https://api.github.com/users/jamesmcclain/repos","events_url":"https://api.github.com/users/jamesmcclain/events{/privacy}","received_events_url":"https://api.github.com/users/jamesmcclain/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jamesmcclain/geotrellis","description":"GeoTrellis is a geographic data processing engine for high performance applications.","fork":true,"url":"https://api.github.com/repos/jamesmcclain/geotrellis","forks_url":"https://api.github.com/repos/jamesmcclain/geotrellis/forks","keys_url":"https://api.github.com/repos/jamesmcclain/geotrellis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jamesmcclain/geotrellis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jamesmcclain/geotrellis/teams","hooks_url":"https://api.github.com/repos/jamesmcclain/geotrellis/hooks","issue_events_url":"https://api.github.com/repos/jamesmcclain/geotrellis/issues/events{/number}","events_url":"https://api.github.com/repos/jamesmcclain/geotrellis/events","assignees_url":"https://api.github.com/repos/jamesmcclain/geotrellis/assignees{/user}","branches_url":"https://api.github.com/repos/jamesmcclain/geotrellis/branches{/branch}","tags_url":"https://api.github.com/repos/jamesmcclain/geotrellis/tags","blobs_url":"https://api.github.com/repos/jamesmcclain/geotrellis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jamesmcclain/geotrellis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jamesmcclain/geotrellis/git/refs{/sha}","trees_url":"https://api.github.com/repos/jamesmcclain/geotrellis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jamesmcclain/geotrellis/statuses/{sha}","languages_url":"https://api.github.com/repos/jamesmcclain/geotrellis/languages","stargazers_url":"https://api.github.com/repos/jamesmcclain/geotrellis/stargazers","contributors_url":"https://api.github.com/repos/jamesmcclain/geotrellis/contributors","subscribers_url":"https://api.github.com/repos/jamesmcclain/geotrellis/subscribers","subscription_url":"https://api.github.com/repos/jamesmcclain/geotrellis/subscription","commits_url":"https://api.github.com/repos/jamesmcclain/geotrellis/commits{/sha}","git_commits_url":"https://api.github.com/repos/jamesmcclain/geotrellis/git/commits{/sha}","comments_url":"https://api.github.com/repos/jamesmcclain/geotrellis/comments{/number}","issue_comment_url":"https://api.github.com/repos/jamesmcclain/geotrellis/issues/comments{/number}","contents_url":"https://api.github.com/repos/jamesmcclain/geotrellis/contents/{+path}","compare_url":"https://api.github.com/repos/jamesmcclain/geotrellis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jamesmcclain/geotrellis/merges","archive_url":"https://api.github.com/repos/jamesmcclain/geotrellis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jamesmcclain/geotrellis/downloads","issues_url":"https://api.github.com/repos/jamesmcclain/geotrellis/issues{/number}","pulls_url":"https://api.github.com/repos/jamesmcclain/geotrellis/pulls{/number}","milestones_url":"https://api.github.com/repos/jamesmcclain/geotrellis/milestones{/number}","notifications_url":"https://api.github.com/repos/jamesmcclain/geotrellis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jamesmcclain/geotrellis/labels{/name}","releases_url":"https://api.github.com/repos/jamesmcclain/geotrellis/releases{/id}","deployments_url":"https://api.github.com/repos/jamesmcclain/geotrellis/deployments","created_at":"2015-12-04T15:11:36Z","updated_at":"2016-01-11T16:24:28Z","pushed_at":"2016-08-29T01:11:45Z","git_url":"git://github.com/jamesmcclain/geotrellis.git","ssh_url":"git@github.com:jamesmcclain/geotrellis.git","clone_url":"https://github.com/jamesmcclain/geotrellis.git","svn_url":"https://github.com/jamesmcclain/geotrellis","homepage":"http://geotrellis.io","size":272110,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"geotrellis:master","ref":"master","sha":"2077839af21c373d08b8fe86c36ade34bc91e0cb","user":{"login":"geotrellis","id":3129444,"avatar_url":"https://avatars.githubusercontent.com/u/3129444?v=3","gravatar_id":"","url":"https://api.github.com/users/geotrellis","html_url":"https://github.com/geotrellis","followers_url":"https://api.github.com/users/geotrellis/followers","following_url":"https://api.github.com/users/geotrellis/following{/other_user}","gists_url":"https://api.github.com/users/geotrellis/gists{/gist_id}","starred_url":"https://api.github.com/users/geotrellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geotrellis/subscriptions","organizations_url":"https://api.github.com/users/geotrellis/orgs","repos_url":"https://api.github.com/users/geotrellis/repos","events_url":"https://api.github.com/users/geotrellis/events{/privacy}","received_events_url":"https://api.github.com/users/geotrellis/received_events","type":"Organization","site_admin":false},"repo":{"id":3040675,"name":"geotrellis","full_name":"geotrellis/geotrellis","owner":{"login":"geotrellis","id":3129444,"avatar_url":"https://avatars.githubusercontent.com/u/3129444?v=3","gravatar_id":"","url":"https://api.github.com/users/geotrellis","html_url":"https://github.com/geotrellis","followers_url":"https://api.github.com/users/geotrellis/followers","following_url":"https://api.github.com/users/geotrellis/following{/other_user}","gists_url":"https://api.github.com/users/geotrellis/gists{/gist_id}","starred_url":"https://api.github.com/users/geotrellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geotrellis/subscriptions","organizations_url":"https://api.github.com/users/geotrellis/orgs","repos_url":"https://api.github.com/users/geotrellis/repos","events_url":"https://api.github.com/users/geotrellis/events{/privacy}","received_events_url":"https://api.github.com/users/geotrellis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/geotrellis/geotrellis","description":"GeoTrellis is a geographic data processing engine for high performance applications.","fork":false,"url":"https://api.github.com/repos/geotrellis/geotrellis","forks_url":"https://api.github.com/repos/geotrellis/geotrellis/forks","keys_url":"https://api.github.com/repos/geotrellis/geotrellis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geotrellis/geotrellis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geotrellis/geotrellis/teams","hooks_url":"https://api.github.com/repos/geotrellis/geotrellis/hooks","issue_events_url":"https://api.github.com/repos/geotrellis/geotrellis/issues/events{/number}","events_url":"https://api.github.com/repos/geotrellis/geotrellis/events","assignees_url":"https://api.github.com/repos/geotrellis/geotrellis/assignees{/user}","branches_url":"https://api.github.com/repos/geotrellis/geotrellis/branches{/branch}","tags_url":"https://api.github.com/repos/geotrellis/geotrellis/tags","blobs_url":"https://api.github.com/repos/geotrellis/geotrellis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geotrellis/geotrellis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geotrellis/geotrellis/git/refs{/sha}","trees_url":"https://api.github.com/repos/geotrellis/geotrellis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geotrellis/geotrellis/statuses/{sha}","languages_url":"https://api.github.com/repos/geotrellis/geotrellis/languages","stargazers_url":"https://api.github.com/repos/geotrellis/geotrellis/stargazers","contributors_url":"https://api.github.com/repos/geotrellis/geotrellis/contributors","subscribers_url":"https://api.github.com/repos/geotrellis/geotrellis/subscribers","subscription_url":"https://api.github.com/repos/geotrellis/geotrellis/subscription","commits_url":"https://api.github.com/repos/geotrellis/geotrellis/commits{/sha}","git_commits_url":"https://api.github.com/repos/geotrellis/geotrellis/git/commits{/sha}","comments_url":"https://api.github.com/repos/geotrellis/geotrellis/comments{/number}","issue_comment_url":"https://api.github.com/repos/geotrellis/geotrellis/issues/comments{/number}","contents_url":"https://api.github.com/repos/geotrellis/geotrellis/contents/{+path}","compare_url":"https://api.github.com/repos/geotrellis/geotrellis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geotrellis/geotrellis/merges","archive_url":"https://api.github.com/repos/geotrellis/geotrellis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geotrellis/geotrellis/downloads","issues_url":"https://api.github.com/repos/geotrellis/geotrellis/issues{/number}","pulls_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls{/number}","milestones_url":"https://api.github.com/repos/geotrellis/geotrellis/milestones{/number}","notifications_url":"https://api.github.com/repos/geotrellis/geotrellis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geotrellis/geotrellis/labels{/name}","releases_url":"https://api.github.com/repos/geotrellis/geotrellis/releases{/id}","deployments_url":"https://api.github.com/repos/geotrellis/geotrellis/deployments","created_at":"2011-12-23T14:56:54Z","updated_at":"2016-08-26T07:22:32Z","pushed_at":"2016-08-30T19:50:21Z","git_url":"git://github.com/geotrellis/geotrellis.git","ssh_url":"git@github.com:geotrellis/geotrellis.git","clone_url":"https://github.com/geotrellis/geotrellis.git","svn_url":"https://github.com/geotrellis/geotrellis","homepage":"http://geotrellis.io","size":284659,"stargazers_count":463,"watchers_count":463,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":140,"mirror_url":null,"open_issues_count":89,"forks":140,"open_issues":89,"watchers":463,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1542"},"html":{"href":"https://github.com/geotrellis/geotrellis/pull/1542"},"issue":{"href":"https://api.github.com/repos/geotrellis/geotrellis/issues/1542"},"comments":{"href":"https://api.github.com/repos/geotrellis/geotrellis/issues/1542/comments"},"review_comments":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1542/comments"},"review_comment":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1542/commits"},"statuses":{"href":"https://api.github.com/repos/geotrellis/geotrellis/statuses/5faa27c949f6b214aeec33b3480538aba5d4bdef"}}}}
{"actor":{"display_login":"lossyrob"}}