Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stac-utils/stac-migrate
A tool to migrate Items, Catalogs and Collections from old versions to the most recent one.
https://github.com/stac-utils/stac-migrate
Last synced: 3 months ago
JSON representation
A tool to migrate Items, Catalogs and Collections from old versions to the most recent one.
- Host: GitHub
- URL: https://github.com/stac-utils/stac-migrate
- Owner: stac-utils
- License: apache-2.0
- Created: 2021-01-25T18:13:14.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-14T12:04:24.000Z (9 months ago)
- Last Synced: 2024-07-19T17:53:04.057Z (4 months ago)
- Language: JavaScript
- Size: 75.2 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-earthobservation-code - stac-migrate - A tool to migrate Items, Catalogs and Collections from old versions to the most recent one. `Javascript` (`Python` processing of optical imagery (non deep learning) / Cloud Native Geospatial)
README
# stac-migrate
A library to update STAC files to the latest version (**1.0.0** at the moment of writing). Supports updating **STAC versions 0.6.0 and later**.
Version of this library: **1.6.0**
## Usage
### JavaScript / Node
Add to your project with `npm install @radiantearth/stac-migrate --save`
Import the library: `const Migrate = require('@radiantearth/stac-migrate');`
* Migrate (auto-detection): `Migrate.stac(stac: object, updateVersionNumber: boolean = true) => object`
*This method does not migrate the Commons extension - use `Migrate.item` if you have used the Commons extension.*
* Migrate a STAC Collection: `Migrate.collection(collection: object, updateVersionNumber: boolean = true) => object`
* Migrate a STAC Catalog: `Migrate.catalog(catalog: object, updateVersionNumber: boolean = true) => object`
* Migrate a STAC Item: `Migrate.item(item: object, collection: object = null, updateVersionNumber: boolean = true) => object`
*The `collection` parameter is only required to migrate the Commons extension. Otherwise, you don't need to pass this paramater.*
* Migrate a STAC CollectionCollection: `Migrate.collectionCollection(apiCollections: object, updateVersionNumber: boolean = true) => object`
* Migrate a STAC ItemCollection: `Migrate.itemCollection(apiItems: object, updateVersionNumber: boolean = true) => object`**Note:** All changes will be applied in-place! If you don't want the input object to change, make a deep clone before. If you don't have a library which supports this (e.g. [lodash](https://lodash.com/docs/4.17.15#cloneDeep)) you can simply use `var clone = JSON.parse(JSON.stringify(object));`.
### CLI
You can also use the CLI to migrate a single file.
The commands follow the different methods above and has the same "restrictions" as above.* Migrate (auto-detection, override): `npx stac-migrate `
* Migrate (auto-detection, save to a different file with 4 spaces indentation): `npx stac-migrate --dest --indent 4`
* Migrate a STAC Collection: `npx stac-migrate --collection`
* Migrate a STAC Catalog: `npx stac-migrate --catalog`
* Migrate a STAC Item: `npx stac-migrate --item --collection_path `
* Migrate a STAC Item Collection: `npx stac-migrate --item_collection`
* Migrate a STAC Collection Collection: `npx stac-migrate --collecions`## Supported Extensions
* Checksum (legacy, use `Migrate.enableMultihash(require('multihashes'))` to enable conversion from pre-0.9 checksums - disabled by default to keep the bundle size low)
* Classification 1.1.0
* Collection Assets (legacy)
* Commons (legacy)
* Data Cube 2.1.0
* Datetime Range (legacy)
* Electro-Optical 1.0.0
* File 1.0.0
* (Item) Asset Definition 1.0.0
* Label 1.0.1
* Point Cloud 1.0.0
* Procesing 1.1.0
* Projection 1.0.0
* Raster 1.1.0
* SAR 1.0.0
* Satellite 1.0.0
* Scientific Citation 1.0.0
* Single Item
* Table 1.2.0
* Timestamps 1.0.0
* Versioning Indicators 1.0.0
* View Geometry 1.0.0## Development
Run the tests: `npm test`