GitHub PullRequestReviewCommentEvent at 2014-08-11 02:17:33
Repository: geomesa
Actor: ronq
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/locationtech/geomesa/pulls/comments/16035765","id":16035765,"diff_hunk":"@@ -0,0 +1,134 @@\n+package geomesa.core.process.knn\n+\n+import collection.JavaConverters._\n+import com.vividsolutions.jts.geom.GeometryFactory\n+import geomesa.core.data.AccumuloFeatureCollection\n+import geomesa.utils.geotools.Conversions._\n+import org.apache.log4j.Logger\n+import org.geotools.data.Query\n+import org.geotools.data.simple.{SimpleFeatureSource, SimpleFeatureCollection}\n+import org.geotools.data.store.ReTypingFeatureCollection\n+import org.geotools.factory.CommonFactoryFinder\n+import org.geotools.feature.DefaultFeatureCollection\n+import org.geotools.feature.visitor.{CalcResult, FeatureCalc, AbstractCalcResult}\n+import org.geotools.process.factory.{DescribeParameter, DescribeResult, DescribeProcess}\n+import org.geotools.util.NullProgressListener\n+import org.opengis.feature.Feature\n+import org.opengis.filter.Filter\n+\n+@DescribeProcess(\n+  title = \"Geomesa-enabled K Nearest Neighbor Search\",\n+  description = \"Performs a K Nearest Neighbor search on a Geomesa feature collection using another feature collection as input\"\n+)\n+class KNearestNeighborSearchProcess {\n+\n+  private val log = Logger.getLogger(classOf[KNearestNeighborSearchProcess])\n+\n+  @DescribeResult(description = \"Output feature collection\")\n+  def execute(\n+               @DescribeParameter(\n+                 name = \"inputFeatures\",\n+                 description = \"Input feature collection that defines the KNN search\")\n+               inputFeatures: SimpleFeatureCollection,\n+\n+               @DescribeParameter(\n+                 name = \"dataFeatures\",\n+                 description = \"The data set to query for matching features\")\n+               dataFeatures: SimpleFeatureCollection,\n+\n+               @DescribeParameter(\n+                 name = \"numDesired\",\n+                 description = \"K: number of nearest neighbors to return\")\n+               numDesired: java.lang.Integer,\n+\n+               @DescribeParameter(\n+                 name = \"estimatedDistance\",\n+                 description = \"Estimate of Search Distance in meters for K neighbors---used to set the granularity of the search\")\n+               estimatedDistance: java.lang.Double,\n+\n+               @DescribeParameter(\n+                 name = \"maxSearchDistance\",\n+                 description = \"Maximum search distance in meters---used to prevent runaway queries of the entire table\")\n+               maxSearchDistance: java.lang.Double\n+               ): SimpleFeatureCollection = {\n+\n+    log.info(\"Attempting Geomesa K-Nearest Neighbor Search on collection type \" + dataFeatures.getClass.getName)\n+\n+    if(!dataFeatures.isInstanceOf[AccumuloFeatureCollection]) {\n+      log.warn(\"The provided data feature collection type may not support geomesa KNN search: \"+dataFeatures.getClass.getName)\n+    }\n+    if(dataFeatures.isInstanceOf[ReTypingFeatureCollection]) {\n+      log.warn(\"WARNING: layer name in geoserver must match feature type name in geomesa\")\n+    }\n+    val visitor = new KNNVisitor(inputFeatures, dataFeatures, numDesired, estimatedDistance, maxSearchDistance)\n+    dataFeatures.accepts(visitor, new NullProgressListener)\n+    visitor.getResult.asInstanceOf[KNNResult].results\n+  }\n+}\n+\n+/**\n+ *  The main visitor class for the KNN search process\n+ */\n+\n+class KNNVisitor( inputFeatures: SimpleFeatureCollection,\n+                               dataFeatures: SimpleFeatureCollection,","path":"geomesa-core/src/main/scala/geomesa/core/process/knn/KNearestNeighborSearchProcess.scala","position":74,"original_position":74,"commit_id":"09201addf9b920eea908a189997b44eb028d5db4","original_commit_id":"e58dd67f428e83b279c657a093a3d162245be973","user":{"login":"ronq","id":5257756,"avatar_url":"https://avatars.githubusercontent.com/u/5257756?v=2","gravatar_id":"90c634d0b668abb35c72667ddd060bc1","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":"changed.","created_at":"2014-08-11T02:17:33Z","updated_at":"2014-08-11T02:17:33Z","html_url":"https://github.com/locationtech/geomesa/pull/147#discussion_r16035765","pull_request_url":"https://api.github.com/repos/locationtech/geomesa/pulls/147","_links":{"self":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/comments/16035765"},"html":{"href":"https://github.com/locationtech/geomesa/pull/147#discussion_r16035765"},"pull_request":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/147"}}},"pull_request":{"url":"https://api.github.com/repos/locationtech/geomesa/pulls/147","id":18803609,"html_url":"https://github.com/locationtech/geomesa/pull/147","diff_url":"https://github.com/locationtech/geomesa/pull/147.diff","patch_url":"https://github.com/locationtech/geomesa/pull/147.patch","issue_url":"https://api.github.com/repos/locationtech/geomesa/issues/147","number":147,"state":"open","title":"Commit for comments for the KNN search.","user":{"login":"ronq","id":5257756,"avatar_url":"https://avatars.githubusercontent.com/u/5257756?v=2","gravatar_id":"90c634d0b668abb35c72667ddd060bc1","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":"This represents the core of the KNN search, but there are still some outstanding items:\r\n\r\n~~1) More unit tests are needed, starting with tests of KNNQuery itself. This is the top priority.~~\r\n~~2) Replacement of SomeGeoHashes: a \"touching\" GeoHash generator needs to replace the BoundingBoxGeoHashIterator.~~\r\n   Also, distances need to be ~~cached and~~ switched over to geodetic calculations.\r\n~~3) The NearestNeighbor SimpleFeature PriorityQueue needs to be bounded to hold \"k\" elements only.~~\r\n4) Distance calculations for SimpleFeatures should be done via transforms instead of client-side.\r\n5) A KNN iterator which does the NearestNeighbor sorting and bounding  server-side could then be introduced.","created_at":"2014-07-23T21:16:17Z","updated_at":"2014-08-11T02:17:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"09d3f948b0fa4f081c13774259aed0928caaf071","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/locationtech/geomesa/pulls/147/commits","review_comments_url":"https://api.github.com/repos/locationtech/geomesa/pulls/147/comments","review_comment_url":"https://api.github.com/repos/locationtech/geomesa/pulls/comments/{number}","comments_url":"https://api.github.com/repos/locationtech/geomesa/issues/147/comments","statuses_url":"https://api.github.com/repos/locationtech/geomesa/statuses/09201addf9b920eea908a189997b44eb028d5db4","head":{"label":"ronq:comments_only_wip_knn_search","ref":"comments_only_wip_knn_search","sha":"09201addf9b920eea908a189997b44eb028d5db4","user":{"login":"ronq","id":5257756,"avatar_url":"https://avatars.githubusercontent.com/u/5257756?v=2","gravatar_id":"90c634d0b668abb35c72667ddd060bc1","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},"repo":{"id":20961229,"name":"geomesa","full_name":"ronq/geomesa","owner":{"login":"ronq","id":5257756,"avatar_url":"https://avatars.githubusercontent.com/u/5257756?v=2","gravatar_id":"90c634d0b668abb35c72667ddd060bc1","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},"private":false,"html_url":"https://github.com/ronq/geomesa","description":"","fork":true,"url":"https://api.github.com/repos/ronq/geomesa","forks_url":"https://api.github.com/repos/ronq/geomesa/forks","keys_url":"https://api.github.com/repos/ronq/geomesa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ronq/geomesa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ronq/geomesa/teams","hooks_url":"https://api.github.com/repos/ronq/geomesa/hooks","issue_events_url":"https://api.github.com/repos/ronq/geomesa/issues/events{/number}","events_url":"https://api.github.com/repos/ronq/geomesa/events","assignees_url":"https://api.github.com/repos/ronq/geomesa/assignees{/user}","branches_url":"https://api.github.com/repos/ronq/geomesa/branches{/branch}","tags_url":"https://api.github.com/repos/ronq/geomesa/tags","blobs_url":"https://api.github.com/repos/ronq/geomesa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ronq/geomesa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ronq/geomesa/git/refs{/sha}","trees_url":"https://api.github.com/repos/ronq/geomesa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ronq/geomesa/statuses/{sha}","languages_url":"https://api.github.com/repos/ronq/geomesa/languages","stargazers_url":"https://api.github.com/repos/ronq/geomesa/stargazers","contributors_url":"https://api.github.com/repos/ronq/geomesa/contributors","subscribers_url":"https://api.github.com/repos/ronq/geomesa/subscribers","subscription_url":"https://api.github.com/repos/ronq/geomesa/subscription","commits_url":"https://api.github.com/repos/ronq/geomesa/commits{/sha}","git_commits_url":"https://api.github.com/repos/ronq/geomesa/git/commits{/sha}","comments_url":"https://api.github.com/repos/ronq/geomesa/comments{/number}","issue_comment_url":"https://api.github.com/repos/ronq/geomesa/issues/comments/{number}","contents_url":"https://api.github.com/repos/ronq/geomesa/contents/{+path}","compare_url":"https://api.github.com/repos/ronq/geomesa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ronq/geomesa/merges","archive_url":"https://api.github.com/repos/ronq/geomesa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ronq/geomesa/downloads","issues_url":"https://api.github.com/repos/ronq/geomesa/issues{/number}","pulls_url":"https://api.github.com/repos/ronq/geomesa/pulls{/number}","milestones_url":"https://api.github.com/repos/ronq/geomesa/milestones{/number}","notifications_url":"https://api.github.com/repos/ronq/geomesa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ronq/geomesa/labels{/name}","releases_url":"https://api.github.com/repos/ronq/geomesa/releases{/id}","created_at":"2014-06-18T12:29:23Z","updated_at":"2014-07-22T21:27:38Z","pushed_at":"2014-08-10T02:18:09Z","git_url":"git://github.com/ronq/geomesa.git","ssh_url":"git@github.com:ronq/geomesa.git","clone_url":"https://github.com/ronq/geomesa.git","svn_url":"https://github.com/ronq/geomesa","homepage":null,"size":3179,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"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:accumulo1.5.x/1.x","ref":"accumulo1.5.x/1.x","sha":"756ad893dba15d186f55eeb47cbc6403d711a641","user":{"login":"locationtech","id":1991411,"avatar_url":"https://avatars.githubusercontent.com/u/1991411?v=2","gravatar_id":"c043b60ab8bed0c48ca8252132150aa8","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=2","gravatar_id":"c043b60ab8bed0c48ca8252132150aa8","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":"2014-08-09T02:53:26Z","pushed_at":"2014-08-08T15:48:33Z","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":12320,"stargazers_count":22,"watchers_count":22,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":19,"mirror_url":null,"open_issues_count":7,"forks":19,"open_issues":7,"watchers":22,"default_branch":"accumulo1.5.x/1.x"}},"_links":{"self":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/147"},"html":{"href":"https://github.com/locationtech/geomesa/pull/147"},"issue":{"href":"https://api.github.com/repos/locationtech/geomesa/issues/147"},"comments":{"href":"https://api.github.com/repos/locationtech/geomesa/issues/147/comments"},"review_comments":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/147/comments"},"review_comment":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/147/commits"},"statuses":{"href":"https://api.github.com/repos/locationtech/geomesa/statuses/09201addf9b920eea908a189997b44eb028d5db4"}}}}