npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@radiantearth/stac-migrate

v2.0.0

Published

A library to update STAC files to the latest version.

Downloads

18,397

Readme

stac-migrate

A library to update STAC files to the latest version (1.1.0 at the moment of writing). Supports updating STAC versions 0.6.0 and later.

Version of this library: 2.0.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) 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 <source_path>
  • Migrate (auto-detection, save to a different file with 4 spaces indentation): npx stac-migrate <source_path> --dest <dest_path> --indent 4
  • Migrate a STAC Collection: npx stac-migrate <source_path> <dest_path> --collection
  • Migrate a STAC Catalog: npx stac-migrate <source_path> <dest_path> --catalog
  • Migrate a STAC Item: npx stac-migrate <source_path> <dest_path> --item --collection_path <collection_path>
  • Migrate a STAC Item Collection: npx stac-migrate <source_path> <dest_path> --item_collection
  • Migrate a STAC Collection Collection: npx stac-migrate <source_path> <dest_path> --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 2.0.0
  • Collection Assets (legacy)
  • Commons (legacy)
  • Data Cube 2.2.0
  • Datetime Range (legacy)
  • Electro-Optical 2.0.0
  • File 2.1.0 (and 1.0.0 for nodata)
  • Item Asset Definition 1.0.0 (legacy)
  • Label 1.0.1
  • Point Cloud 1.0.0
  • Processing 1.2.0
  • Projection 2.0.0
  • Raster 2.0.0
  • SAR 1.0.0
  • Satellite 1.0.0
  • Scientific Citation 1.0.0
  • Single Item
  • Table 1.2.0
  • Timestamps 1.1.0
  • Versioning Indicators 1.2.0
  • View Geometry 1.0.0

Development

Run the tests: npm test