Open gadomski opened 3 years ago
I do think this functionality should perhaps be layered into one or two other commands, similar to how -a in a copy will move assets.
Hrm, though now I'm struggling to come up with a very clear compelling use case for this. It looks like move assets results in relative links (I think that might have not always been the case before? I seem to remember move-assets resulting in absolute links, which would then require this, but I don't see that now in my bits of testing). I was working with a lot of different test directories so was not copying the assets, but I think doing a move-assets
at the end of my flow likely solves the main thing I was aiming to do?
So I'm struggling to come up with the use case where you'd want a relative link to assets that aren't moved to your directory. So perhaps the main thing is to confirm that move-assets always results in relative links?
From there I think #12 is the most useful flow for me - I want to go back to absolute links when I 'publish'. But I'm not going to be running stac copy directly on GCS / S3 (though that would be a cool feature - use an s3 or gcs bucket as the 'destination' in a stac copy.
I think the other place this comes up is that Planet's convert-order default outputs absolute links. Hrm, though also realizing that #29 is now in and should mitigate that.
Ok, sorry for the dump, I think the tl;dr is that I probably just need to update my workflows and may not need. I'll leave this open for a bit as I work through things, and close when it's fully clear if it's not needed.
So I was hoping to get to a point to say that we don't need to do this, but I've been struggling with the move-assets command, see #146. I do suspect 'merge', 'merge -a', 'move-assets' and 'copy -a' all work consistently then I think this is likely not needed, but want to get to that state first before closing this issue.
I do think #12 will be quite useful though, and I wonder if there's an asset-centric generic version of that, that's like 'update-asset-links', and lets you specify 'relative' (turns all your links relative, perhaps with a -a option to move them to be in your directory if they aren't there), 'absolute' (turns everything to absolute local paths) and 'remote', which takes a URL argument where you can specify where the assets will go.
As mentioned in https://github.com/stac-utils/stactools/issues/124#issuecomment-866004997, there is a use-case for modifying an existing STAC to convert asset HREFs to relative, distinct from
stac move-assets
because the assets are already there. The simplest solution is to makestac make-asset-links-relative
, but clearly it'd be better if there were more functionality we could put under a shorter sub-command name. Ideas?