question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Docs error and suggestion

See original GitHub issue

On https://cogeotiff.github.io/rio-cogeo/API/ under 1. you have:

src_transform = from_bounds(*bounds, 1024, 1024)

src_profile = dict(
    driver="GTiff",
    dtype="float32",
    count=3,
    height=1024,
    width=1024,
    crs="epsg:4326",
    transform=dst_transform,
)

But this should read:

src_transform = from_bounds(*bounds, 1024, 1024)

src_profile = dict(
    driver="GTiff",
    dtype="float32",
    count=3,
    height=1024,
    width=1024,
    crs="epsg:4326",
    transform=src_transform,
)

i.e. transform=src_transform,

Also a suggested improvement is to show in from_bounds the height/width order

from_bounds(*bounds, width=1024, height=1024)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
robmarkcolecommented, Jan 22, 2021

Another error spotted, in 2.:

dst_profile = cog_profiles.get("deflate")

with MemoryFile() as mem_dst:
    # Important, we pass `mem_dst.name` as output dataset path
    cog_translate("my-input-file.tif", mem_dst.name, profile, in_memory=True)

should be

dst_profile = cog_profiles.get("deflate")

with MemoryFile() as mem_dst:
    # Important, we pass `mem_dst.name` as output dataset path
    cog_translate("my-input-file.tif", mem_dst.name, dst_profile, in_memory=True)

i.e. profile -> dst_profile.

However I assume we can write straight to S3 without needing to write a local file and using cog_translate?

@kylebarron sure I will create a PR, doing some work with rio-cog so might find some more changes to include

1reaction
vincentsaragocommented, Jan 22, 2021

i.e. profile -> dst_profile.

👍

However I assume we can write straight to S3 without needing to write a local file and using cog_translate?

I’m not sure to understand, you mean trying to use Rasterio to write directly to S3? I never tried and as far as I remember it wasn’t possible 🤷‍♂️

just re-tried, and I don’t think it’s possible (at least with goal 2.4)

import rasterio
from rasterio.shutils import copy

with rasterio.open("file.tif") as c:
    copy(c, "s3://my-bucket/test.tif", **c.profile)

>>> CPLE_OpenFailedError: Attempt to create new tiff file 's3://my-bucket/test.tif' failed: No such file or directory

edits: yes, rasterio won’t support writing a vsi file: https://github.com/mapbox/rasterio/issues/1159#issuecomment-532800520

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot Google Docs, Sheets, Slides & Forms error ...
If you get an error message such as "Something went wrong. Reload" or "Unable to load file" preventing you from making edits on...
Read more >
Google Docs: Using Suggestion Mode to Track Changes
In this lesson, you'll learn how to enable suggestion mode, approve and reject changes, and comment on suggested edits.
Read more >
New grammar suggestions in Google Docs launching to Early ...
We're introducing grammar suggestions in Google Docs along with a revamped interface for spelling and grammar review. The new features build ...
Read more >
6 fast fixes for common Google Docs problems
Knock down distressing Docs issues in no time with these easy-to-implement, expert-approved solutions. · 1: Edit regret; Google Docs problem No.
Read more >
Why so tense? Let grammar suggestions in Google Docs ...
Today we're taking that a step further by using machine translation techniques to help you catch tricky grammatical errors, too, with grammar ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found