{"action":"created","comment":{"url":"https://api.github.com/repos/locationtech/geomesa/pulls/comments/32254666","id":32254666,"diff_hunk":"@@ -0,0 +1,107 @@\n+/*\n+ * Copyright 2014 Commonwealth Computer Research, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.locationtech.geomesa.tools.ingest\n+\n+import java.awt.RenderingHints\n+import java.io.{File, Serializable}\n+import java.util.{Map => JMap}\n+import javax.media.jai.{ImageLayout, JAI}\n+\n+import com.twitter.scalding.Args\n+import com.typesafe.scalalogging.slf4j.Logging\n+import org.geotools.coverage.grid.io.AbstractGridCoverage2DReader\n+import org.geotools.coverageio.gdal.dted.DTEDReader\n+import org.geotools.factory.Hints\n+import org.geotools.gce.geotiff.GeoTiffReader\n+import org.locationtech.geomesa.accumulo.data.AccumuloDataStoreFactory.{params => dsp}\n+import org.locationtech.geomesa.raster.data.AccumuloRasterStore\n+import org.locationtech.geomesa.raster.util.RasterUtils.IngestRasterParams\n+import org.locationtech.geomesa.raster.{RasterParams => rsp}\n+import org.locationtech.geomesa.tools.Utils.Formats._\n+\n+import scala.collection.JavaConversions._\n+\n+trait RasterIngest extends Logging {\n+  def getAccumuloRasterStoreConf(config: Map[String, Option[String]]): JMap[String, Serializable] =\n+    mapAsJavaMap(Map(\n+      dsp.instanceIdParam.getName   -> config(IngestRasterParams.ACCUMULO_INSTANCE).get,\n+      dsp.zookeepersParam.getName   -> config(IngestRasterParams.ZOOKEEPERS).get,\n+      dsp.userParam.getName         -> config(IngestRasterParams.ACCUMULO_USER).get,\n+      dsp.passwordParam.getName     -> config(IngestRasterParams.ACCUMULO_PASSWORD).get,\n+      dsp.tableNameParam.getName    -> config(IngestRasterParams.TABLE).get,\n+      dsp.authsParam.getName        -> config(IngestRasterParams.AUTHORIZATIONS),\n+      dsp.visibilityParam.getName   -> config(IngestRasterParams.VISIBILITIES),\n+      rsp.writeMemoryParam.getName  -> config(IngestRasterParams.WRITE_MEMORY),\n+      dsp.writeThreadsParam         -> config(IngestRasterParams.WRITE_THREADS),\n+      dsp.queryThreadsParam.getName -> config(IngestRasterParams.QUERY_THREADS),\n+      dsp.mockParam.getName         -> config(IngestRasterParams.ACCUMULO_MOCK)\n+    ).collect {\n+      case (key, Some(value)) => (key, value);\n+      case (key, value: String) => (key, value)\n+    }).asInstanceOf[java.util.Map[String, Serializable]]\n+\n+  def createRasterStore(config: Map[String, Option[String]]): AccumuloRasterStore = {\n+    val rasterName = config(IngestRasterParams.TABLE)\n+    if (rasterName == null || rasterName.isEmpty) {\n+      logger.error(\"No raster name specified for raster feature ingest.\" +\n+        \" Please check that all arguments are correct in the previous command. \")\n+      sys.exit()\n+    }\n+\n+    val csConfig: JMap[String, Serializable] = getAccumuloRasterStoreConf(config)\n+\n+    AccumuloRasterStore(csConfig)\n+  }\n+\n+  def createRasterStore(args: Args): AccumuloRasterStore = {\n+    val dsConfig: Map[String, Option[String]] =\n+      Map(\n+        IngestRasterParams.ZOOKEEPERS        -> args.optional(IngestRasterParams.ZOOKEEPERS),\n+        IngestRasterParams.ACCUMULO_INSTANCE -> args.optional(IngestRasterParams.ACCUMULO_INSTANCE),\n+        IngestRasterParams.ACCUMULO_USER     -> args.optional(IngestRasterParams.ACCUMULO_USER),\n+        IngestRasterParams.ACCUMULO_PASSWORD -> args.optional(IngestRasterParams.ACCUMULO_PASSWORD),\n+        IngestRasterParams.TABLE             -> args.optional(IngestRasterParams.TABLE),\n+        IngestRasterParams.GEOSERVER_REG     -> args.optional(IngestRasterParams.GEOSERVER_REG),\n+        IngestRasterParams.AUTHORIZATIONS    -> args.optional(IngestRasterParams.AUTHORIZATIONS),\n+        IngestRasterParams.VISIBILITIES      -> args.optional(IngestRasterParams.VISIBILITIES),\n+        IngestRasterParams.WRITE_MEMORY      -> args.optional(IngestRasterParams.WRITE_MEMORY),\n+        IngestRasterParams.WRITE_THREADS     -> args.optional(IngestRasterParams.WRITE_THREADS),\n+        IngestRasterParams.QUERY_THREADS     -> args.optional(IngestRasterParams.QUERY_THREADS),\n+        IngestRasterParams.ACCUMULO_MOCK     -> args.optional(IngestRasterParams.ACCUMULO_MOCK)\n+      )\n+    createRasterStore(dsConfig)\n+  }\n+\n+  def getReader(imageFile: File, imageType: String): AbstractGridCoverage2DReader = {\n+    imageType match {\n+      case TIFF => getTiffReader(imageFile)\n+      case DTED => getDtedReader(imageFile)\n+      case _ => throw new Exception(\"Image type is not supported.\")\n+    }\n+  }\n+\n+  def getTiffReader(imageFile: File): AbstractGridCoverage2DReader = {\n+    new GeoTiffReader(imageFile, new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, true))\n+  }\n+\n+  def getDtedReader(imageFile: File): AbstractGridCoverage2DReader = {\n+    val l = new ImageLayout()\n+    l.setTileGridXOffset(0).setTileGridYOffset(0).setTileHeight(512).setTileWidth(512)","path":"geomesa-tools/src/main/scala/org/locationtech/geomesa/tools/ingest/RasterIngest.scala","position":102,"original_position":102,"commit_id":"e815040b22f87d7a3f178ce29a89b136b95d14ea","original_commit_id":"e815040b22f87d7a3f178ce29a89b136b95d14ea","user":{"login":"ronq","id":5257756,"avatar_url":"https://avatars.githubusercontent.com/u/5257756?v=3","gravatar_id":"","url":"https://api.github.com/users/ronq","html_url":"https://github.com/ronq","followers_url":"https://api.github.com/users/ronq/followers","following_url":"https://api.github.com/users/ronq/following{/other_user}","gists_url":"https://api.github.com/users/ronq/gists{/gist_id}","starred_url":"https://api.github.com/users/ronq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ronq/subscriptions","organizations_url":"https://api.github.com/users/ronq/orgs","repos_url":"https://api.github.com/users/ronq/repos","events_url":"https://api.github.com/users/ronq/events{/privacy}","received_events_url":"https://api.github.com/users/ronq/received_events","type":"User","site_admin":false},"body":"Does this assume that all Dted images are 512 x 512 ? ","created_at":"2015-06-11T18:50:43Z","updated_at":"2015-06-11T18:50:43Z","html_url":"https://github.com/locationtech/geomesa/pull/598#discussion_r32254666","pull_request_url":"https://api.github.com/repos/locationtech/geomesa/pulls/598","_links":{"self":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/comments/32254666"},"html":{"href":"https://github.com/locationtech/geomesa/pull/598#discussion_r32254666"},"pull_request":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/598"}}},"pull_request":{"url":"https://api.github.com/repos/locationtech/geomesa/pulls/598","id":36857001,"html_url":"https://github.com/locationtech/geomesa/pull/598","diff_url":"https://github.com/locationtech/geomesa/pull/598.diff","patch_url":"https://github.com/locationtech/geomesa/pull/598.patch","issue_url":"https://api.github.com/repos/locationtech/geomesa/issues/598","number":598,"state":"open","locked":false,"title":"Added Raster Module","user":{"login":"AndrewAnnex","id":2126916,"avatar_url":"https://avatars.githubusercontent.com/u/2126916?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrewAnnex","html_url":"https://github.com/AndrewAnnex","followers_url":"https://api.github.com/users/AndrewAnnex/followers","following_url":"https://api.github.com/users/AndrewAnnex/following{/other_user}","gists_url":"https://api.github.com/users/AndrewAnnex/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewAnnex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewAnnex/subscriptions","organizations_url":"https://api.github.com/users/AndrewAnnex/orgs","repos_url":"https://api.github.com/users/AndrewAnnex/repos","events_url":"https://api.github.com/users/AndrewAnnex/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewAnnex/received_events","type":"User","site_admin":false},"body":"* refactored raster metadata to now be a KryoSimpleFeature\r\n* removed leading tilda in rows\r\n* added readme to raster module\r\n* removed AccumuloCoverageStore, geoserver ingest bits\r\n* deleteraster command added\r\n\r\nSigned-off-by: Andrew Annex <aannex@ccri.com>","created_at":"2015-06-03T17:29:37Z","updated_at":"2015-06-11T18:50:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc92ab86109c8ffdf8662665ad7815f4084d7a90","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/locationtech/geomesa/pulls/598/commits","review_comments_url":"https://api.github.com/repos/locationtech/geomesa/pulls/598/comments","review_comment_url":"https://api.github.com/repos/locationtech/geomesa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/locationtech/geomesa/issues/598/comments","statuses_url":"https://api.github.com/repos/locationtech/geomesa/statuses/e815040b22f87d7a3f178ce29a89b136b95d14ea","head":{"label":"AndrewAnnex:fcr_add_raster_module_to_master","ref":"fcr_add_raster_module_to_master","sha":"e815040b22f87d7a3f178ce29a89b136b95d14ea","user":{"login":"AndrewAnnex","id":2126916,"avatar_url":"https://avatars.githubusercontent.com/u/2126916?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrewAnnex","html_url":"https://github.com/AndrewAnnex","followers_url":"https://api.github.com/users/AndrewAnnex/followers","following_url":"https://api.github.com/users/AndrewAnnex/following{/other_user}","gists_url":"https://api.github.com/users/AndrewAnnex/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewAnnex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewAnnex/subscriptions","organizations_url":"https://api.github.com/users/AndrewAnnex/orgs","repos_url":"https://api.github.com/users/AndrewAnnex/repos","events_url":"https://api.github.com/users/AndrewAnnex/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewAnnex/received_events","type":"User","site_admin":false},"repo":{"id":21002360,"name":"geomesa","full_name":"AndrewAnnex/geomesa","owner":{"login":"AndrewAnnex","id":2126916,"avatar_url":"https://avatars.githubusercontent.com/u/2126916?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrewAnnex","html_url":"https://github.com/AndrewAnnex","followers_url":"https://api.github.com/users/AndrewAnnex/followers","following_url":"https://api.github.com/users/AndrewAnnex/following{/other_user}","gists_url":"https://api.github.com/users/AndrewAnnex/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewAnnex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewAnnex/subscriptions","organizations_url":"https://api.github.com/users/AndrewAnnex/orgs","repos_url":"https://api.github.com/users/AndrewAnnex/repos","events_url":"https://api.github.com/users/AndrewAnnex/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewAnnex/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AndrewAnnex/geomesa","description":"core","fork":true,"url":"https://api.github.com/repos/AndrewAnnex/geomesa","forks_url":"https://api.github.com/repos/AndrewAnnex/geomesa/forks","keys_url":"https://api.github.com/repos/AndrewAnnex/geomesa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AndrewAnnex/geomesa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AndrewAnnex/geomesa/teams","hooks_url":"https://api.github.com/repos/AndrewAnnex/geomesa/hooks","issue_events_url":"https://api.github.com/repos/AndrewAnnex/geomesa/issues/events{/number}","events_url":"https://api.github.com/repos/AndrewAnnex/geomesa/events","assignees_url":"https://api.github.com/repos/AndrewAnnex/geomesa/assignees{/user}","branches_url":"https://api.github.com/repos/AndrewAnnex/geomesa/branches{/branch}","tags_url":"https://api.github.com/repos/AndrewAnnex/geomesa/tags","blobs_url":"https://api.github.com/repos/AndrewAnnex/geomesa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AndrewAnnex/geomesa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AndrewAnnex/geomesa/git/refs{/sha}","trees_url":"https://api.github.com/repos/AndrewAnnex/geomesa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AndrewAnnex/geomesa/statuses/{sha}","languages_url":"https://api.github.com/repos/AndrewAnnex/geomesa/languages","stargazers_url":"https://api.github.com/repos/AndrewAnnex/geomesa/stargazers","contributors_url":"https://api.github.com/repos/AndrewAnnex/geomesa/contributors","subscribers_url":"https://api.github.com/repos/AndrewAnnex/geomesa/subscribers","subscription_url":"https://api.github.com/repos/AndrewAnnex/geomesa/subscription","commits_url":"https://api.github.com/repos/AndrewAnnex/geomesa/commits{/sha}","git_commits_url":"https://api.github.com/repos/AndrewAnnex/geomesa/git/commits{/sha}","comments_url":"https://api.github.com/repos/AndrewAnnex/geomesa/comments{/number}","issue_comment_url":"https://api.github.com/repos/AndrewAnnex/geomesa/issues/comments{/number}","contents_url":"https://api.github.com/repos/AndrewAnnex/geomesa/contents/{+path}","compare_url":"https://api.github.com/repos/AndrewAnnex/geomesa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AndrewAnnex/geomesa/merges","archive_url":"https://api.github.com/repos/AndrewAnnex/geomesa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AndrewAnnex/geomesa/downloads","issues_url":"https://api.github.com/repos/AndrewAnnex/geomesa/issues{/number}","pulls_url":"https://api.github.com/repos/AndrewAnnex/geomesa/pulls{/number}","milestones_url":"https://api.github.com/repos/AndrewAnnex/geomesa/milestones{/number}","notifications_url":"https://api.github.com/repos/AndrewAnnex/geomesa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AndrewAnnex/geomesa/labels{/name}","releases_url":"https://api.github.com/repos/AndrewAnnex/geomesa/releases{/id}","created_at":"2014-06-19T14:03:14Z","updated_at":"2015-04-14T19:53:04Z","pushed_at":"2015-06-11T16:32:09Z","git_url":"git://github.com/AndrewAnnex/geomesa.git","ssh_url":"git@github.com:AndrewAnnex/geomesa.git","clone_url":"https://github.com/AndrewAnnex/geomesa.git","svn_url":"https://github.com/AndrewAnnex/geomesa","homepage":"","size":8384,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"accumulo1.5.x/1.x"}},"base":{"label":"locationtech:master","ref":"master","sha":"5595bdaeac207ddfb7903246f3a97bc45b6e0c88","user":{"login":"locationtech","id":1991411,"avatar_url":"https://avatars.githubusercontent.com/u/1991411?v=3","gravatar_id":"","url":"https://api.github.com/users/locationtech","html_url":"https://github.com/locationtech","followers_url":"https://api.github.com/users/locationtech/followers","following_url":"https://api.github.com/users/locationtech/following{/other_user}","gists_url":"https://api.github.com/users/locationtech/gists{/gist_id}","starred_url":"https://api.github.com/users/locationtech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/locationtech/subscriptions","organizations_url":"https://api.github.com/users/locationtech/orgs","repos_url":"https://api.github.com/users/locationtech/repos","events_url":"https://api.github.com/users/locationtech/events{/privacy}","received_events_url":"https://api.github.com/users/locationtech/received_events","type":"Organization","site_admin":false},"repo":{"id":13226069,"name":"geomesa","full_name":"locationtech/geomesa","owner":{"login":"locationtech","id":1991411,"avatar_url":"https://avatars.githubusercontent.com/u/1991411?v=3","gravatar_id":"","url":"https://api.github.com/users/locationtech","html_url":"https://github.com/locationtech","followers_url":"https://api.github.com/users/locationtech/followers","following_url":"https://api.github.com/users/locationtech/following{/other_user}","gists_url":"https://api.github.com/users/locationtech/gists{/gist_id}","starred_url":"https://api.github.com/users/locationtech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/locationtech/subscriptions","organizations_url":"https://api.github.com/users/locationtech/orgs","repos_url":"https://api.github.com/users/locationtech/repos","events_url":"https://api.github.com/users/locationtech/events{/privacy}","received_events_url":"https://api.github.com/users/locationtech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/locationtech/geomesa","description":"","fork":false,"url":"https://api.github.com/repos/locationtech/geomesa","forks_url":"https://api.github.com/repos/locationtech/geomesa/forks","keys_url":"https://api.github.com/repos/locationtech/geomesa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/locationtech/geomesa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/locationtech/geomesa/teams","hooks_url":"https://api.github.com/repos/locationtech/geomesa/hooks","issue_events_url":"https://api.github.com/repos/locationtech/geomesa/issues/events{/number}","events_url":"https://api.github.com/repos/locationtech/geomesa/events","assignees_url":"https://api.github.com/repos/locationtech/geomesa/assignees{/user}","branches_url":"https://api.github.com/repos/locationtech/geomesa/branches{/branch}","tags_url":"https://api.github.com/repos/locationtech/geomesa/tags","blobs_url":"https://api.github.com/repos/locationtech/geomesa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/locationtech/geomesa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/locationtech/geomesa/git/refs{/sha}","trees_url":"https://api.github.com/repos/locationtech/geomesa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/locationtech/geomesa/statuses/{sha}","languages_url":"https://api.github.com/repos/locationtech/geomesa/languages","stargazers_url":"https://api.github.com/repos/locationtech/geomesa/stargazers","contributors_url":"https://api.github.com/repos/locationtech/geomesa/contributors","subscribers_url":"https://api.github.com/repos/locationtech/geomesa/subscribers","subscription_url":"https://api.github.com/repos/locationtech/geomesa/subscription","commits_url":"https://api.github.com/repos/locationtech/geomesa/commits{/sha}","git_commits_url":"https://api.github.com/repos/locationtech/geomesa/git/commits{/sha}","comments_url":"https://api.github.com/repos/locationtech/geomesa/comments{/number}","issue_comment_url":"https://api.github.com/repos/locationtech/geomesa/issues/comments{/number}","contents_url":"https://api.github.com/repos/locationtech/geomesa/contents/{+path}","compare_url":"https://api.github.com/repos/locationtech/geomesa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/locationtech/geomesa/merges","archive_url":"https://api.github.com/repos/locationtech/geomesa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/locationtech/geomesa/downloads","issues_url":"https://api.github.com/repos/locationtech/geomesa/issues{/number}","pulls_url":"https://api.github.com/repos/locationtech/geomesa/pulls{/number}","milestones_url":"https://api.github.com/repos/locationtech/geomesa/milestones{/number}","notifications_url":"https://api.github.com/repos/locationtech/geomesa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/locationtech/geomesa/labels{/name}","releases_url":"https://api.github.com/repos/locationtech/geomesa/releases{/id}","created_at":"2013-09-30T20:13:46Z","updated_at":"2015-06-11T02:02:05Z","pushed_at":"2015-06-11T16:32:10Z","git_url":"git://github.com/locationtech/geomesa.git","ssh_url":"git@github.com:locationtech/geomesa.git","clone_url":"https://github.com/locationtech/geomesa.git","svn_url":"https://github.com/locationtech/geomesa","homepage":null,"size":20672,"stargazers_count":80,"watchers_count":80,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":48,"mirror_url":null,"open_issues_count":18,"forks":48,"open_issues":18,"watchers":80,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/598"},"html":{"href":"https://github.com/locationtech/geomesa/pull/598"},"issue":{"href":"https://api.github.com/repos/locationtech/geomesa/issues/598"},"comments":{"href":"https://api.github.com/repos/locationtech/geomesa/issues/598/comments"},"review_comments":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/598/comments"},"review_comment":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/598/commits"},"statuses":{"href":"https://api.github.com/repos/locationtech/geomesa/statuses/e815040b22f87d7a3f178ce29a89b136b95d14ea"}}}}