Replies: 6 comments
-
@zacharyDez 👋 your COGs don't have CRS or geo_transform set, but use GCPS (ground control points) for geo-reference. Sadly you can't use cogeo-mosaic cli directly for this.
# cog_gcp_info.py
from rio_tiler.io import GCPCOGReader
import click
from rasterio.rio import options
import json
@click.command()
@options.file_in_arg
def main(input):
"""Read tile."""
with GCPCOGReader(input) as cog:
bounds = cog.geographic_bounds
click.echo(
json.dumps(
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[bounds[0], bounds[3]],
[bounds[0], bounds[1]],
[bounds[2], bounds[1]],
[bounds[2], bounds[3]],
[bounds[0], bounds[3]],
]
],
},
"properties": {
"path": input,
"bounds": cog.geographic_bounds,
"minzoom": cog.minzoom,
"maxzoom": cog.maxzoom,
"datatype": cog.dataset.meta["dtype"],
},
"type": "Feature",
}
)
)
if __name__ == '__main__':
main()
# using parallel is optional
$ cat 1996.txt | parallel -j 4 python -m cog_gcp_info {} > 1996.json
$ cat 1996.json| cogeo-mosaic create-from-features --minzoom 8 --maxzoom 12 -o 1996_mosaic.json --prop
erty path |
Beta Was this translation helpful? Give feedback.
-
Side notes: ➜ Dev cat 1996.json| jq '.properties.minzoom' | sort | uniq
10
2
3
4
5
6
7
8
9
➜ Dev cat 1996.json| jq '.properties.maxzoom' | sort | uniq
10
11
12
13
14
15
8
9 which might in fact correspond to different Product, it might be smart to first select only some scenes instead of creating one mosaic of all scenes. Also, note that there are a lot of overlaping scenes which might impact the performance. list of features: https://gist.github.com/vincentsarago/f099516b216b6fd7ff4ca7ac2c43f7d4 |
Beta Was this translation helpful? Give feedback.
-
side note 2: the mosaic won't work natively in TiTiler, you'll need to use MosaicTilerFactory and set the |
Beta Was this translation helpful? Give feedback.
-
Thanks @vincentsarago ! on point as always. Will try to work through this shortly. I'll get back to you. |
Beta Was this translation helpful? Give feedback.
-
@zacharyDez are we good to close here? |
Beta Was this translation helpful? Give feedback.
-
yes, sorry @vincentsarago, did not get a chance to get back to this. |
Beta Was this translation helpful? Give feedback.
-
Hi @vincentsarago,
I've been trying to test out the creation of a mosaic from a repo of radarsat imagery of the canadian federal government. I saw some issues related to s3 paths and replacing with the equivalent HTTP URLs. I can curl the URLs defined within the .txt file.
I initially created the list of images with:
I lazily just deleted all the radarsat imagery that did not have the same configurations to avoid the datatype errors. I then ran
cogeo-mosaic create 1996.txt -o mosaic.json
. I'm getting the following warnings but I am not sure how to interpret them:The resulting mosaic has no tiles:
The output .txt is:
Any suggestions on next steps to solve the issue? Any other tips are more than welcome.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions