-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to write RasterFrame tile columns directly as raster files. #571
Conversation
val sample = tileFiles(dest).next() | ||
val tags = SinglebandGeoTiff(sample.toString()).tags.headTags | ||
tags.keys should contain ("testval") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
...
.withCatalog | ||
.save(dest.toString) | ||
|
||
countTiles(dest, ".png") should be (df.count()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"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
...
val fs = FileSystem.get(pathURI, conf.value) | ||
val localPath = new Path(new Path(pathURI), fName) | ||
copyMerge(fs, hPath, fs, localPath, true, conf.value) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@echeipesh @pomadchin Maybe this could be replaced with something that's more STAC oriented?
// 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: _*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This effectively drops the raster columns so the coalesce(1)
in the catalog write doesn't end up moving raster data across nodes.
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) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
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: