{"action":"created","comment":{"url":"https://api.github.com/repos/GitHubRGI/swagd/pulls/comments/28616070","id":28616070,"diff_hunk":"@@ -158,94 +215,101 @@ public void close()\n         {\n             this.dataset.delete();\n         }\n-\n-        //gdal.GDALDestroyDriverManager();\n     }\n \n     @Override\n-    public BoundingBox getBounds() throws TileStoreException\n+    public BoundingBox getBounds()\n     {\n-        // Input dataset should be in the SRS the user wants\n-        try\n-        {\n-            return GdalUtility.getBoundsForDataset(this.dataset);\n-        }\n-        catch(final DataFormatException ex)\n-        {\n-            throw new TileStoreException(ex);\n-        }\n+        return this.dataBounds;\n     }\n \n     @Override\n-    public long countTiles() throws TileStoreException {\n-        throw new TileStoreException(new OperationNotSupportedException());\n+    public long countTiles()\n+    {\n+        return this.tileCount;\n     }\n \n     @Override\n-    public long getByteSize() throws TileStoreException {\n-        throw new TileStoreException(new OperationNotSupportedException());\n+    public long getByteSize()\n+    {\n+        return this.rawImage.length();\n     }\n \n     @Override\n-    public BufferedImage getTile(final int column, final int row, final int zoomLevel)\n-            throws TileStoreException {\n+    public BufferedImage getTile(final int column, final int row, final int zoomLevel) throws TileStoreException\n+    {\n         throw new TileStoreException(new OperationNotSupportedException());\n     }\n \n     @Override\n-    public BufferedImage getTile(final CrsCoordinate coordinate, final int zoomLevel)\n-            throws TileStoreException {\n+    public BufferedImage getTile(final CrsCoordinate coordinate, final int zoomLevel) throws TileStoreException\n+    {\n         throw new TileStoreException(new OperationNotSupportedException());\n     }\n \n     @Override\n-    public Set<Integer> getZoomLevels() throws TileStoreException\n+    public Set<Integer> getZoomLevels()\n     {\n-        // Return the Set of zoom levels, with a LowerLeft origin\n-        return GdalUtility.getZoomLevelsForDataset(this.dataset,\n-                                                   RawImageTileReader.tileOrigin,\n-                                                   this.tileSize);\n+        return this.zoomLevels;\n     }\n \n     @Override\n-    public Stream<TileHandle> stream() throws TileStoreException {\n-        throw new TileStoreException(new OperationNotSupportedException());\n+    public Stream<TileHandle> stream() throws TileStoreException\n+    {\n+        final List<TileHandle> tileHandles = new ArrayList<>();\n+\n+        final Range<Integer> zoomRange = new Range<>(this.zoomLevels, Integer::compare);\n+\n+        for(int zoomLevel = zoomRange.getMaximum(); zoomLevel >= zoomRange.getMinimum(); --zoomLevel) //for(final int zoomLevel : this.zoomLevels)\n+        {\n+            final Range<Coordinate<Integer>> zoomInfo = this.tileRanges.get(zoomLevel);\n+\n+            // Get the coordinate information\n+            final Coordinate<Integer> topLeftCoordinate     = zoomInfo.getMinimum();\n+            final Coordinate<Integer> bottomRightCoordinate = zoomInfo.getMaximum();\n+\n+            // Parse each coordinate into min/max tiles for X/Y\n+            final int zoomMinXTile =     topLeftCoordinate.getX();\n+            final int zoomMaxXTile = bottomRightCoordinate.getX();\n+            final int zoomMinYTile = bottomRightCoordinate.getY();\n+            final int zoomMaxYTile =     topLeftCoordinate.getY();\n+\n+            for(int tileY = zoomMaxYTile; tileY >= zoomMinYTile; --tileY)\n+            {\n+                for(int tileX = zoomMinXTile; tileX <= zoomMaxXTile; ++tileX)\n+                {\n+                    tileHandles.add(new RawImageTileHandle(zoomLevel, tileX, tileY));\n+                }\n+            }\n+        }\n+\n+        // Return the entire tile handle list as a stream\n+        return tileHandles.stream();\n     }\n \n     @Override\n-    public Stream<TileHandle> stream(final int zoomLevel) throws TileStoreException {\n-        // Create a new tile scheme\n-        // zoomLevel should be the minZoom of the raw image (lowest integer zoom)\n-        // this zoom should only have one tile\n-        final TileScheme tileScheme = new ZoomTimesTwo(zoomLevel, zoomLevel, 1, 1);\n-        final CrsProfile crsProfile = GdalUtility.getCrsProfileForDataset(this.dataset);\n-        // Calculate the tile ranges for all the zoom levels (0-31)\n-        final List<Range<Coordinate<Integer>>> tileRanges = GdalUtility.calculateTileRangesForAllZooms(this.getBounds(),\n-                                                                                                       crsProfile,\n-                                                                                                       tileScheme,\n-                                                                                                       TileOrigin.LowerLeft);\n-        // Pick out the zoom level range for this particular zoom\n-        final Range<Coordinate<Integer>> zoomInfo = tileRanges.get(zoomLevel);\n+    public Stream<TileHandle> stream(final int zoomLevel)\n+    {\n+        final Range<Coordinate<Integer>> zoomInfo = this.tileRanges.get(zoomLevel);\n+\n         // Get the coordinate information\n-        final Coordinate<Integer> topLeftCoordinate = zoomInfo.getMinimum();\n+        final Coordinate<Integer> topLeftCoordinate     = zoomInfo.getMinimum();\n         final Coordinate<Integer> bottomRightCoordinate = zoomInfo.getMaximum();\n+\n         // Parse each coordinate into min/max tiles for X/Y\n-        final int zoomMinXTile = topLeftCoordinate.getX();\n+        final int zoomMinXTile =     topLeftCoordinate.getX();\n         final int zoomMaxXTile = bottomRightCoordinate.getX();\n         final int zoomMinYTile = bottomRightCoordinate.getY();\n-        final int zoomMaxYTile = topLeftCoordinate.getY();\n+        final int zoomMaxYTile =     topLeftCoordinate.getY();","path":"Gdal2Tiles/src/com/rgi/g2t/RawImageTileReader.java","position":353,"original_position":357,"commit_id":"e6198b78d9b88ad5e10bb6dd236d3e9e8434ebee","original_commit_id":"b9d24b509bb2424dd540eedc72cf850ef33d3921","user":{"login":"stevendlander","id":3169732,"avatar_url":"https://avatars.githubusercontent.com/u/3169732?v=3","gravatar_id":"","url":"https://api.github.com/users/stevendlander","html_url":"https://github.com/stevendlander","followers_url":"https://api.github.com/users/stevendlander/followers","following_url":"https://api.github.com/users/stevendlander/following{/other_user}","gists_url":"https://api.github.com/users/stevendlander/gists{/gist_id}","starred_url":"https://api.github.com/users/stevendlander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevendlander/subscriptions","organizations_url":"https://api.github.com/users/stevendlander/orgs","repos_url":"https://api.github.com/users/stevendlander/repos","events_url":"https://api.github.com/users/stevendlander/events{/privacy}","received_events_url":"https://api.github.com/users/stevendlander/received_events","type":"User","site_admin":false},"body":"Do you see weird indentations here?  it looks like line 300 is coming out by a tab width, but 301 and 302 are not.","created_at":"2015-04-17T18:01:51Z","updated_at":"2015-04-17T18:01:51Z","html_url":"https://github.com/GitHubRGI/swagd/pull/195#discussion_r28616070","pull_request_url":"https://api.github.com/repos/GitHubRGI/swagd/pulls/195","_links":{"self":{"href":"https://api.github.com/repos/GitHubRGI/swagd/pulls/comments/28616070"},"html":{"href":"https://github.com/GitHubRGI/swagd/pull/195#discussion_r28616070"},"pull_request":{"href":"https://api.github.com/repos/GitHubRGI/swagd/pulls/195"}}},"pull_request":{"url":"https://api.github.com/repos/GitHubRGI/swagd/pulls/195","id":33544420,"html_url":"https://github.com/GitHubRGI/swagd/pull/195","diff_url":"https://github.com/GitHubRGI/swagd/pull/195.diff","patch_url":"https://github.com/GitHubRGI/swagd/pull/195.patch","issue_url":"https://api.github.com/repos/GitHubRGI/swagd/issues/195","number":195,"state":"open","locked":false,"title":"Tiling to gpkg 184","user":{"login":"LLambertRGi","id":5478360,"avatar_url":"https://avatars.githubusercontent.com/u/5478360?v=3","gravatar_id":"","url":"https://api.github.com/users/LLambertRGi","html_url":"https://github.com/LLambertRGi","followers_url":"https://api.github.com/users/LLambertRGi/followers","following_url":"https://api.github.com/users/LLambertRGi/following{/other_user}","gists_url":"https://api.github.com/users/LLambertRGi/gists{/gist_id}","starred_url":"https://api.github.com/users/LLambertRGi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LLambertRGi/subscriptions","organizations_url":"https://api.github.com/users/LLambertRGi/orgs","repos_url":"https://api.github.com/users/LLambertRGi/repos","events_url":"https://api.github.com/users/LLambertRGi/events{/privacy}","received_events_url":"https://api.github.com/users/LLambertRGi/received_events","type":"User","site_admin":false},"body":"create a GeoPackage directly from the tiling process","created_at":"2015-04-17T13:35:14Z","updated_at":"2015-04-17T18:01:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3ae8335dc84554df67efcbe39d625ff48c51a573","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GitHubRGI/swagd/pulls/195/commits","review_comments_url":"https://api.github.com/repos/GitHubRGI/swagd/pulls/195/comments","review_comment_url":"https://api.github.com/repos/GitHubRGI/swagd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GitHubRGI/swagd/issues/195/comments","statuses_url":"https://api.github.com/repos/GitHubRGI/swagd/statuses/e6198b78d9b88ad5e10bb6dd236d3e9e8434ebee","head":{"label":"GitHubRGI:tiling-to-gpkg-#184","ref":"tiling-to-gpkg-#184","sha":"e6198b78d9b88ad5e10bb6dd236d3e9e8434ebee","user":{"login":"GitHubRGI","id":532280,"avatar_url":"https://avatars.githubusercontent.com/u/532280?v=3","gravatar_id":"","url":"https://api.github.com/users/GitHubRGI","html_url":"https://github.com/GitHubRGI","followers_url":"https://api.github.com/users/GitHubRGI/followers","following_url":"https://api.github.com/users/GitHubRGI/following{/other_user}","gists_url":"https://api.github.com/users/GitHubRGI/gists{/gist_id}","starred_url":"https://api.github.com/users/GitHubRGI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GitHubRGI/subscriptions","organizations_url":"https://api.github.com/users/GitHubRGI/orgs","repos_url":"https://api.github.com/users/GitHubRGI/repos","events_url":"https://api.github.com/users/GitHubRGI/events{/privacy}","received_events_url":"https://api.github.com/users/GitHubRGI/received_events","type":"User","site_admin":false},"repo":{"id":27885801,"name":"swagd","full_name":"GitHubRGI/swagd","owner":{"login":"GitHubRGI","id":532280,"avatar_url":"https://avatars.githubusercontent.com/u/532280?v=3","gravatar_id":"","url":"https://api.github.com/users/GitHubRGI","html_url":"https://github.com/GitHubRGI","followers_url":"https://api.github.com/users/GitHubRGI/followers","following_url":"https://api.github.com/users/GitHubRGI/following{/other_user}","gists_url":"https://api.github.com/users/GitHubRGI/gists{/gist_id}","starred_url":"https://api.github.com/users/GitHubRGI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GitHubRGI/subscriptions","organizations_url":"https://api.github.com/users/GitHubRGI/orgs","repos_url":"https://api.github.com/users/GitHubRGI/repos","events_url":"https://api.github.com/users/GitHubRGI/events{/privacy}","received_events_url":"https://api.github.com/users/GitHubRGI/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GitHubRGI/swagd","description":"A Java-based application for tiling geospatial images into tiles, packaging those tiles, and viewing them on a map.","fork":false,"url":"https://api.github.com/repos/GitHubRGI/swagd","forks_url":"https://api.github.com/repos/GitHubRGI/swagd/forks","keys_url":"https://api.github.com/repos/GitHubRGI/swagd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GitHubRGI/swagd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GitHubRGI/swagd/teams","hooks_url":"https://api.github.com/repos/GitHubRGI/swagd/hooks","issue_events_url":"https://api.github.com/repos/GitHubRGI/swagd/issues/events{/number}","events_url":"https://api.github.com/repos/GitHubRGI/swagd/events","assignees_url":"https://api.github.com/repos/GitHubRGI/swagd/assignees{/user}","branches_url":"https://api.github.com/repos/GitHubRGI/swagd/branches{/branch}","tags_url":"https://api.github.com/repos/GitHubRGI/swagd/tags","blobs_url":"https://api.github.com/repos/GitHubRGI/swagd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GitHubRGI/swagd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GitHubRGI/swagd/git/refs{/sha}","trees_url":"https://api.github.com/repos/GitHubRGI/swagd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GitHubRGI/swagd/statuses/{sha}","languages_url":"https://api.github.com/repos/GitHubRGI/swagd/languages","stargazers_url":"https://api.github.com/repos/GitHubRGI/swagd/stargazers","contributors_url":"https://api.github.com/repos/GitHubRGI/swagd/contributors","subscribers_url":"https://api.github.com/repos/GitHubRGI/swagd/subscribers","subscription_url":"https://api.github.com/repos/GitHubRGI/swagd/subscription","commits_url":"https://api.github.com/repos/GitHubRGI/swagd/commits{/sha}","git_commits_url":"https://api.github.com/repos/GitHubRGI/swagd/git/commits{/sha}","comments_url":"https://api.github.com/repos/GitHubRGI/swagd/comments{/number}","issue_comment_url":"https://api.github.com/repos/GitHubRGI/swagd/issues/comments{/number}","contents_url":"https://api.github.com/repos/GitHubRGI/swagd/contents/{+path}","compare_url":"https://api.github.com/repos/GitHubRGI/swagd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GitHubRGI/swagd/merges","archive_url":"https://api.github.com/repos/GitHubRGI/swagd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GitHubRGI/swagd/downloads","issues_url":"https://api.github.com/repos/GitHubRGI/swagd/issues{/number}","pulls_url":"https://api.github.com/repos/GitHubRGI/swagd/pulls{/number}","milestones_url":"https://api.github.com/repos/GitHubRGI/swagd/milestones{/number}","notifications_url":"https://api.github.com/repos/GitHubRGI/swagd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GitHubRGI/swagd/labels{/name}","releases_url":"https://api.github.com/repos/GitHubRGI/swagd/releases{/id}","created_at":"2014-12-11T18:37:12Z","updated_at":"2015-04-14T18:11:07Z","pushed_at":"2015-04-17T18:01:43Z","git_url":"git://github.com/GitHubRGI/swagd.git","ssh_url":"git@github.com:GitHubRGI/swagd.git","clone_url":"https://github.com/GitHubRGI/swagd.git","svn_url":"https://github.com/GitHubRGI/swagd","homepage":null,"size":44695,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":50,"forks":1,"open_issues":50,"watchers":0,"default_branch":"master"}},"base":{"label":"GitHubRGI:master","ref":"master","sha":"8feb8a2f281ca59b924dc50db628b9a2cbf6edc9","user":{"login":"GitHubRGI","id":532280,"avatar_url":"https://avatars.githubusercontent.com/u/532280?v=3","gravatar_id":"","url":"https://api.github.com/users/GitHubRGI","html_url":"https://github.com/GitHubRGI","followers_url":"https://api.github.com/users/GitHubRGI/followers","following_url":"https://api.github.com/users/GitHubRGI/following{/other_user}","gists_url":"https://api.github.com/users/GitHubRGI/gists{/gist_id}","starred_url":"https://api.github.com/users/GitHubRGI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GitHubRGI/subscriptions","organizations_url":"https://api.github.com/users/GitHubRGI/orgs","repos_url":"https://api.github.com/users/GitHubRGI/repos","events_url":"https://api.github.com/users/GitHubRGI/events{/privacy}","received_events_url":"https://api.github.com/users/GitHubRGI/received_events","type":"User","site_admin":false},"repo":{"id":27885801,"name":"swagd","full_name":"GitHubRGI/swagd","owner":{"login":"GitHubRGI","id":532280,"avatar_url":"https://avatars.githubusercontent.com/u/532280?v=3","gravatar_id":"","url":"https://api.github.com/users/GitHubRGI","html_url":"https://github.com/GitHubRGI","followers_url":"https://api.github.com/users/GitHubRGI/followers","following_url":"https://api.github.com/users/GitHubRGI/following{/other_user}","gists_url":"https://api.github.com/users/GitHubRGI/gists{/gist_id}","starred_url":"https://api.github.com/users/GitHubRGI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GitHubRGI/subscriptions","organizations_url":"https://api.github.com/users/GitHubRGI/orgs","repos_url":"https://api.github.com/users/GitHubRGI/repos","events_url":"https://api.github.com/users/GitHubRGI/events{/privacy}","received_events_url":"https://api.github.com/users/GitHubRGI/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GitHubRGI/swagd","description":"A Java-based application for tiling geospatial images into tiles, packaging those tiles, and viewing them on a map.","fork":false,"url":"https://api.github.com/repos/GitHubRGI/swagd","forks_url":"https://api.github.com/repos/GitHubRGI/swagd/forks","keys_url":"https://api.github.com/repos/GitHubRGI/swagd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GitHubRGI/swagd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GitHubRGI/swagd/teams","hooks_url":"https://api.github.com/repos/GitHubRGI/swagd/hooks","issue_events_url":"https://api.github.com/repos/GitHubRGI/swagd/issues/events{/number}","events_url":"https://api.github.com/repos/GitHubRGI/swagd/events","assignees_url":"https://api.github.com/repos/GitHubRGI/swagd/assignees{/user}","branches_url":"https://api.github.com/repos/GitHubRGI/swagd/branches{/branch}","tags_url":"https://api.github.com/repos/GitHubRGI/swagd/tags","blobs_url":"https://api.github.com/repos/GitHubRGI/swagd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GitHubRGI/swagd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GitHubRGI/swagd/git/refs{/sha}","trees_url":"https://api.github.com/repos/GitHubRGI/swagd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GitHubRGI/swagd/statuses/{sha}","languages_url":"https://api.github.com/repos/GitHubRGI/swagd/languages","stargazers_url":"https://api.github.com/repos/GitHubRGI/swagd/stargazers","contributors_url":"https://api.github.com/repos/GitHubRGI/swagd/contributors","subscribers_url":"https://api.github.com/repos/GitHubRGI/swagd/subscribers","subscription_url":"https://api.github.com/repos/GitHubRGI/swagd/subscription","commits_url":"https://api.github.com/repos/GitHubRGI/swagd/commits{/sha}","git_commits_url":"https://api.github.com/repos/GitHubRGI/swagd/git/commits{/sha}","comments_url":"https://api.github.com/repos/GitHubRGI/swagd/comments{/number}","issue_comment_url":"https://api.github.com/repos/GitHubRGI/swagd/issues/comments{/number}","contents_url":"https://api.github.com/repos/GitHubRGI/swagd/contents/{+path}","compare_url":"https://api.github.com/repos/GitHubRGI/swagd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GitHubRGI/swagd/merges","archive_url":"https://api.github.com/repos/GitHubRGI/swagd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GitHubRGI/swagd/downloads","issues_url":"https://api.github.com/repos/GitHubRGI/swagd/issues{/number}","pulls_url":"https://api.github.com/repos/GitHubRGI/swagd/pulls{/number}","milestones_url":"https://api.github.com/repos/GitHubRGI/swagd/milestones{/number}","notifications_url":"https://api.github.com/repos/GitHubRGI/swagd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GitHubRGI/swagd/labels{/name}","releases_url":"https://api.github.com/repos/GitHubRGI/swagd/releases{/id}","created_at":"2014-12-11T18:37:12Z","updated_at":"2015-04-14T18:11:07Z","pushed_at":"2015-04-17T18:01:43Z","git_url":"git://github.com/GitHubRGI/swagd.git","ssh_url":"git@github.com:GitHubRGI/swagd.git","clone_url":"https://github.com/GitHubRGI/swagd.git","svn_url":"https://github.com/GitHubRGI/swagd","homepage":null,"size":44695,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":50,"forks":1,"open_issues":50,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GitHubRGI/swagd/pulls/195"},"html":{"href":"https://github.com/GitHubRGI/swagd/pull/195"},"issue":{"href":"https://api.github.com/repos/GitHubRGI/swagd/issues/195"},"comments":{"href":"https://api.github.com/repos/GitHubRGI/swagd/issues/195/comments"},"review_comments":{"href":"https://api.github.com/repos/GitHubRGI/swagd/pulls/195/comments"},"review_comment":{"href":"https://api.github.com/repos/GitHubRGI/swagd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GitHubRGI/swagd/pulls/195/commits"},"statuses":{"href":"https://api.github.com/repos/GitHubRGI/swagd/statuses/e6198b78d9b88ad5e10bb6dd236d3e9e8434ebee"}}}}