Ability to write RasterFrame tile columns directly as raster files.#571
Merged
metasim merged 2 commits intolocationtech:developfrom Nov 11, 2021
Merged
Ability to write RasterFrame tile columns directly as raster files.#571metasim merged 2 commits intolocationtech:developfrom
metasim merged 2 commits intolocationtech:developfrom
Conversation
metasim
commented
Oct 19, 2021
| val sample = tileFiles(dest).next() | ||
| val tags = SinglebandGeoTiff(sample.toString()).tags.headTags | ||
| tags.keys should contain ("testval") | ||
| } |
Member
Author
Member
Author
There was a problem hiding this comment.
The catalog looks something like this (note the metadata columns):
filename,bbox,crs,label,testval
cat/test/1606317768704.tif,[443422.5|4313647.5|443512.5|4315387.5],+proj=utm +zone=16 +datum=WGS84 +units=m +no_defs,cat,test
dog/train/463856467968.tif,[368295.0|4080315.0|372135.0|4083105.0],+proj=utm +zone=18 +datum=WGS84 +units=m +no_defs,dog,train
dog/train/661424963584.tif,[395175.0|4080315.0|395295.0|4083105.0],+proj=utm +zone=18 +datum=WGS84 +units=m +no_defs,dog,train
...
metasim
commented
Oct 19, 2021
| .withCatalog | ||
| .save(dest.toString) | ||
|
|
||
| countTiles(dest, ".png") should be (df.count()) |
Member
Author
There was a problem hiding this comment.
"Catalog" looks something like this:
filename,bbox,crs
446676598784.png,[364455.0|4086945.0|368295.0|4090785.0],+proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
455266533376.png,[387495.0|4106145.0|391335.0|4109985.0],+proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
463856467968.png,[368295.0|4080315.0|372135.0|4083105.0],+proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
...
metasim
commented
Oct 19, 2021
| val fs = FileSystem.get(pathURI, conf.value) | ||
| val localPath = new Path(new Path(pathURI), fName) | ||
| copyMerge(fs, hPath, fs, localPath, true, conf.value) | ||
| } |
Member
Author
There was a problem hiding this comment.
@echeipesh @pomadchin Maybe this could be replaced with something that's more STAC oriented?
metasim
commented
Oct 19, 2021
| // Avoiding commas with this format: | ||
| // [0.489|51.28|0.236|51.686] | ||
| val bbox = s"[${extent.xmin}|${extent.ymin}|${extent.xmax}|${extent.ymax}]" | ||
| Row(finalFilename +: bbox +: crs.toProj4String +: metadata: _*) |
Member
Author
There was a problem hiding this comment.
This effectively drops the raster columns so the coalesce(1) in the catalog write doesn't end up moving raster data across nodes.
metasim
commented
Oct 19, 2021
| val chipTags = tags.copy(headTags = md.updated("base_filename", filename)) | ||
| val geotiff = new MultibandGeoTiff(MultibandTile(tiles), extent, crs, chipTags, tiffOptions) | ||
| geotiff.write(finalPath, hconf.value) | ||
| } |
Member
Author
There was a problem hiding this comment.
Not sure if this is bad form or not, but we're basically performing side effects in a mapPartitions. Check other data sources on how to do this?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Provides support for writing each row of tiles as a single or multiband tile, as GeoTIFF or PNG, with or without a CSV catalog. Output path is configurable via specified column.
TODO: