Coder Social home page Coder Social logo

radiantearth / stac-site Goto Github PK

View Code? Open in Web Editor NEW
24.0 5.0 32.0 38.8 MB

Website for SpatioTemporal Asset Catalog specification

Home Page: https://stacspec.org

HTML 49.76% CSS 0.07% JavaScript 0.49% Dockerfile 0.01% Python 0.01% Jupyter Notebook 49.67%

stac-site's Introduction

Stac Website

Netlify Status

This is the repo for stacspec.org.

The website is built using the Node.js based static site generator 11ty.

Tutorials are created using markdown and jupyter notebooks, and the page templates are written with Nunjucks.

Getting Started

Prereqs

Installation

npm install
npm run serve

If this step results in errors, I recommend using node version 17.8.0, the current stable version at the time of writing.

Creating Tutorials

New tutorials are created in markdown format and added in to the [app/tutorials] directory.

Tutorials are categorized by adding them to a directory in the tutorials folder.

Tutorials should be in their own directory along with any translated versions of the tutorial.

Heres an example:

app/
    tutorials/                           # this is the tutorials root
        getting-started/                 # this is the category
            stac-collections/            # this is the tutorial
                stac-collections.en.md   # this is an english version
                stac-colecciones.es.md   # this is a spanish version

The url paths are autogenerated, for the tutorials shown above they would be:

/en/tutorials/stac-collections
/es/tutorials/stac-collecciones

Tutorial Frontmatter Requirements

You'll need to add a few properties in yml format to the markdown frontmatter at the very top of your file. Here's an example:

---
title: A title for your tutorial, this is used for SEO and in previews throughout the site
description: A short description of the tutorial. This will be used in the meta description and in tutorial previews throughout the site.
notebooks:
    - name-of-notebook-file-no-extension
---

the notebooks property is optional, and will add a notebook from the notebooks/build directory below any markdown content you add to the tutorial.

Compiling Notebooks

Add notebooks to the notebooks/src directory

Notebooks can be built via python 3.9 with the included docker-compose config by running:

docker-compose up

Docker is the more consistent way to compile the notebooks, but you may also run the bash build script directly if you have python 3.x installed on your machine:

cd notebooks
pip3 install -r requirements.txt
sh build_notebooks

Creating Pages

If you want to create a new page, here are the steps you'll follow

  1. Create a .html file for your page template in the app/pages directory.
  2. Create a content file in the content directory, and be sure to require that file in the parent content file (for a new "about" page, include it at the bottom of the content/about/index.js file. For a new base level page, you'd include it in the content/index.js file.
  3. Link the template file with the content file by adding a name to the template frontmatter (see Page Frontmatter Requirements below)
  4. Add a route to the page for each translation (Also see Page Frontmatter Requirements below)
  5. Now you're ready to create your page, you can use the content you add to the content files with the localize filter, i.e. {{ .hero.cta_text | localize }}. Review the Page Content section below for more detail
  6. Pages are written using the Nunjucks templating language, review the Nunjucks documentation to see all the options available to you

Page Frontmatter Requirements

You'll need to add a few properties in yml format to the markdown frontmatter at the very top of your file. Here's an example:

---
route:
    en: /en/example-url-for/english-translation
    es: /es/url-ejemplo-para/traduccion-en-espanol
name: example.correlates.toAContentFile
---

The route property creates the URL for each translated site.

Page Content

All page content is added to the content directory.

The page name property should correlate to the content path. For example name: about.stacSpec correlates to the content/about/stac-spec.js file. This works because the file is exported from the file and imported into the content/about/index.js file, which is then imported into the larger content object at content/index.js.

To reference the content from the correlated content file in the template files, you can use the filter localize, like so:

{{ .hero.cta_text | localize }}

with the first . in .hero referencing that the content should be scoped to that correlated file, rather than the content root.

All content is saved in a format that the Eleventy i18n plugin recommends. The final property in the tree should correlate to a locale code, for example:

hero: {
    cta_text: {
        'en': 'Click',
        'es': 'Hacer clic'
    }
}

If in the future, it becomes too cumbersome to manage content in the filesystem, eleventy can generate content from API calls as well. An example of this can be found in app/_data/catalogs.js

Translations

If you want to translate the site into another language, here are all the steps you'll need to take:

1. Translate all content

In the content files (everything in the content folder), anywhere you see an en: means it is the english version. Add your translation with the locale code right next to that, i.e:

hero: {
    cta_text: {
        'en': 'Click',
        'es': 'Hacer clic'
    }
}

2. Add translated urls

in each template file (anything in pages folder), add your translated route to the routes config. I.e:

---
route:
    en: /en/example-url-for/english-translation
    es: /es/url-ejemplo-para/traduccion-en-espanol
---

3. Translate tutorials

In the tutorials folder, anything with the extension en.md is a tutorial in english. Copy this file in the same folder and add the locale in place of en. You can also translate the filename to give the tutorial a translated url for example hello.en.md would be copied as hola.es.md in the same folder. The url for that would be stacspec.org/es/tutorials/hola.

4. Activate your translated site

In the file app/_data/locales.js, add your locale to the list. Right now the entire contents of that file are:

module.exports = ['en'];

To add spanish, you would update that to be:

module.exports = ['en', 'es'];

Deployment & CI

The site deploys automatically from the master branch using Netlify.

When opening a pull request, Netlify will generate a preview environment.

Architecture

Data

Most of the site data is pulled into the 11ty data cascade and available in template files, either as collections (i.e. app/tutorials) or as global data (i.e. app/_data/catalogs.js.

These are the data types in brief, with links to readme locations where more info is available:

  • pages: Created by 11ty based on the files in app/pages
  • tutorials: Added to app/tutorials directory as markdown files
  • categories: Autogenerated by tutorial directory structure
  • routes: Created from route frontmatter in the page template files
  • content: One big javascript object, passed into global data and accessible via the localize filter

Images

Images are compressed and resized using the Eleventy Image plugin.

You can add an image to the assets/images direcory, and include it in your template files via the image shortcode with a filename, alt text and size. For example:

{% image 'assets/images/STAC-01.png', 'stac logo', '300px' %}

You can also add different sizes for different breakpoints by updating the last parameter, like so:

{% image 'assets/images/STAC-01.png', 'stac logo', '(min-width: 1000px) 800px, 400px' %}

stac-site's People

Contributors

stuartpearman avatar cholmes avatar powerchell avatar gypsybojangles avatar m-mohr avatar pgbrodrick avatar kbgg avatar matthewhanson avatar dc-up42 avatar tomkralidis avatar gadomski avatar normanb avatar bstefansen avatar davidraleigh avatar dkwright avatar tom-butler avatar solomon-negusse avatar saheelbreezo avatar jthetzel avatar tylere avatar treysp avatar sbrunato avatar rbavery avatar mikemahoney218 avatar jedsundwall avatar jbants avatar jaiindimple avatar ciaransweet avatar alukach avatar wilsaj avatar

Stargazers

jenusdy avatar  avatar Afif Fauzan avatar Alaattin Gökmen  avatar Dana Bauer avatar Julian Blau avatar  avatar ZhouxuanXiao avatar Oguzcan Karagoz avatar Dr. Andrew Annex avatar Broski avatar Lhamdouchi Driss avatar Jim Young avatar Liam O'Sullivan avatar Alex G Rice avatar  avatar Kyle Barron avatar Rajat Shinde avatar Michael Sumner avatar  avatar Erdong avatar Seth Fitzsimmons avatar Robin Cole avatar

Watchers

Jeff Siarto avatar  avatar James Cloos avatar  avatar  avatar

stac-site's Issues

add a navigation menu

There are quite a few extra pages with information, but the navigation bar is only for the stuff on the main page. Could be good to have another way to navigate.

better footer

Right now the footer must be edited on each page. Would be better to be able to edit it in one place and have all the pages pull it in automatically.

Add more STAC tools

There's at least a few more tools to add:

  • Staccato - Java STAC API
  • intake stac (or stac intake?) Need to find the link
  • Lite-stac

I think there's some more out there, if anyone has them just add to this ticket.

Content: Get Involved: Data Providers

We need some content for the "Data Providers" page. This is a starting point for data providers to understand and get involved with STAC.

Here is the format needed:

Hero section

Title
i.e. “STAC for data providers”

Content (140-360 characters)

Links (1-5)
i.e. Gitter Community, Github, Tutorials

Bullet points section (2-5 bullet points that will interest data providers)

Content heading for each

Content body section for each (1-3 sentences)

Icon for each (lower priority)
Select icon from https://fontawesome.com/search?m=free

Longform Content (1-3 paragraphs)

Closing thoughts – anything else data providers should know about STAC

1.1 [cng-pacific] Plan Webinar

Determine the following aspects of the webinar:

  • Topic and objectives
  • Target audience
  • Speakers & moderator
  • Date and time / Duration
  • Format/ Technical Requirements

Note the determined information here:

  • Topic and objectives: ...
  • Target audience: ...
  • Speakers & moderator: ...
  • Date and time / Duration: ...
  • Format/ Technical Requirements: ...

Minor typo for required packages on 2-create-stac-catalog-python

Hi all, there's a minor typo in the 2-create-stac-catalog-python notebook:

If you need to install pystac, rasterio, or pystac, uncomment the lines below and run the cell.

should be

If you need to install pystac, rasterio, or shapely, uncomment the lines below and run the cell.

Website renders CQL2 expressions in the R tutorial incorrectly

Throughout the second R tutorial, R objects are injected into CQL2 expressions using {{ operators:

``` r
rstac::stac("https://planetarycomputer.microsoft.com/api/stac/v1") |>
rstac::ext_filter(
collection == "landsat-c2-l2" &&
t_intersects(datetime, {{time_range}})
)
```

This code renders fine on GitHub:

image

But on the website, it seems like this formatting is messing something up, and the bit of code within the {{ operators is missing:

image

Content: Get Involved: Data Users

We need some content for the "Data Users" page. This is a starting point for data users to understand and get involved with STAC.

Here is the format needed:

Hero section

Title
i.e. “STAC for data providers”

Content (140-360 characters)

Links (1-5)
i.e. Gitter Community, Github, Tutorials

Bullet points section (2-5 bullet points that will interest data providers)

Content heading for each

Content body section for each (1-3 sentences)

Icon for each (lower priority)
Select icon from https://fontawesome.com/search?m=free

Longform Content (1-3 paragraphs)

Closing thoughts – anything else data users should know about STAC

link to involvement in spec creation

Who is using right now is just link to companies.

Replace it with a nice visual set of logos, and then have that link to a page that explains everyone's different involvement in the creation of the spec.

Add Microsoft to STAC Companies

Microsoft is sponsor for the STAC sprint. I think we should its logo to image in the front page.

I can't find the individual logos, so I'll add the Microsoft logo to the image above and PR

1. Plan Webinar

Determine the following aspects of the webinar:

  • Topic and objectives
  • Target audience
  • Speakers & moderator
  • Date and time / Duration
  • Format/ Technical Requirements

Note the determined information here:

  • Topic and objectives: ...
  • Target audience: ...
  • Speakers & moderator: ...
  • Date and time / Duration: ...
  • Format/ Technical Requirements: ...

Add Advanced Filter to STAC QGIS Plugin Tutorial #2

During the development of the QGIS tutorials for the STAC site, I ran into the following error when trying to utilize the Advanced filter of the STAC QGIS Plugin:

STAC QGIS plugin advanced filter error

@lossyrob confirmed that the Planetary Computer API and STAC query were working as expected by successfully using this code sample:

import requests
url = "https://planetarycomputer.microsoft.com/api/stac/v1/search"
body = {
    "collections": ["landsat8", "sentinel-2-l2a"],
    "bbox": [-10.415,36.066,3.779,44.213],
    "limit": 200,
    "datetime": "2022-06-01T00:00:00Z/2022-06-30T00:00:00Z",
    "query": {
        "eo:cloud_cover": {
          "gte": 0,
          "lte": 10
        },
    }
}
resp = requests.post(url, json=body)
assert resp.status_code == 200

This leads us to believe that the issue is occurring somewhere in the QGIS plugin. I will be reaching out to the maintainers of the plugin to further progress on fixing this issue. Once the QGIS plugin is performing the queries as expected, we will add in a section to the second QGIS tutorial to teach the user how to use the Advanced filter of the STAC API Browser QGIS plugin.

add pycsw to Server Tools & Resources

Hi all: I'd like to add pycsw as a STAC API server to https://stacspec.org/en/about/tools-resources

It was suggested by @gadomski to add to stacindex.org, which could be feeding stacspec.org. pycsw was successfully added to stacindex.org, but I don't see the update on stacspec.org.

Any ideas? I do see that this repo has a gh-pages branch (which appears to be last built in April 2022), but not sure whether this is powering stacspec.org.

Update implementations

STAC in action and STAC Tools could both use updates to capture the state of the community. We should try to link to more live catalogs, and to link to the json catalog in addition to the stac browser.

Netlify link

STAC has an Open Source Netlify plan (to facilitate deployment of STAC Browsers at the moment). I've added a badge to STAC Browser.

Via email, @fool sez:

I think this would be an appropriate place to link Netlify, at the bottom of https://stacspec.org/#examples under STAC is supported by an active community of developers, with involvement from a large range of organizations. . That fits better than putting us on a github repo's README with our intentions I think :)

@cholmes can you tackle this next time you update the site? (There might need to be some copy changes, as the current list just contains contributor organizations.)

Badges live here: https://www.netlify.com/press/#badges

Error when running tutorial notebook stac-load-e84-aws.ipynb

Executing the tutorial notebook stac-load-e84-aws.ipynb gives me the following error:

DoesNotConformTo                          Traceback (most recent call last)
Cell In[2], line 8
      4 bbox = (x - r, y - r, x + r, y + r)
      6 catalog = Client.open("https://earth-search.aws.element84.com/v0")
----> 8 query = catalog.search(
      9     collections=["sentinel-s2-l2a-cogs"], datetime="2021-09-16", limit=100, bbox=bbox
     10 )
     12 items = list(query.get_items())
     13 print(f"Found: {len(items):d} datasets")

File ~/Library/Caches/pypoetry/virtualenvs/dotfiles-S-yQfRXO-py3.10/lib/python3.10/site-packages/pystac_client/client.py:588, in Client.search(self, method, max_items, limit, ids, collections, bbox, intersects, datetime, query, filter, filter_lang, sortby, fields)
    486 """Query the ``/search`` endpoint using the given parameters.
    487 
    488 This method returns an :class:`~pystac_client.ItemSearch` instance. See that
   (...)
    584         a ``"rel"`` type of ``"search"``.
    585 """
    587 if not self.conforms_to(ConformanceClasses.ITEM_SEARCH):
--> 588     raise DoesNotConformTo(
    589         "ITEM_SEARCH", "There is not fallback option available for search."
    590     )
    592 return ItemSearch(
    593     url=self._search_href(),
    594     method=method,
   (...)
    608     modifier=self.modifier,
    609 )

DoesNotConformTo: Server does not conform to ITEM_SEARCH, There is not fallback option available for search.

I think updating to server "https://earth-search.aws.element84.com/v1" and collection "sentinel-2-l2a" may be necessary.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.