GithubHelp home page GithubHelp logo

ministac's Introduction

Ministac

Ministac is a minimalist Spatio-Temporal Asset Catalog. It allows for instance an institution to have a searchable catalog of their in house satellite images

Features

  • Manages metadata satellite images (items) and satellites images collections
  • Stores information in Postgres database
  • Search catalog using geojson geometry, temporal window, and/or cloud cover
  • Complies with Spatio-Temporal Asset Catalog specifications
  • Metadata validation against JSON schemas of stac-spec
  • Built to work with:
    • ministac-admin (helper scripts to generate the catalog from multiple collections)
    • ministac-api (JSON REST API)
    • ministac-client (does not exist yet)

Installation

A complete installation requires the package, a postgres database with PostGIS extension, and a configuration file with database credentials.

Python package

Activate a python 3 virtual environment and run:

pip install ministac

Database

  • Install postgresql and PostGIS
  • Create the ministac database
  • Enable PostGIS extension for the ministac database
createdb ministac
psql ministac -c "CREATE EXTENSION postgis;"
psql ministac -c "CREATE EXTENSION postgis_topology;"
# Optionally create dedicated user (probably better for remote access)
psql ministac -c "CREATE USER ministac_user WITH PASSWORD 'qwerty' CREATEDB;"

Configuration file

The configuration file must be named ~/.ministac; it contains the database access credentials.

[ministac]
db_database=name_of_the_database
# Optional, depending on database configuration (running on localhost or remote, require password, etc)
# db_hostname=
# db_username=
# db_password=
# db_port=

Usage

Although ministac has a functional API, most common use cases are probably covered by ministac-admin and ministac-api. Nethertheless here are some basic examples of direct use.

import json
from pprint import pprint
import datetime as dt

import ministac
from ministac.db import init_db, session_scope


# Create database tables
init_db()

# Open example collection from test directory of the ministac repository
with open('tests/data/collection_0.json') as src:
    landsat_8_collection = json.load(src)

# Register the Landsat 8 collection to the database
with session_scope() as session:
    ministac.add_collection(session, landsat_8_collection)

# Read some example items
with open('tests/data/item_list.json') as src:
    item_list = json.load(src)

# Ingest the items to the database
with session_scope() as session:
    ministac.add_items(session, item_list, 'landsat_sr_8')


# Query the entire landsat_sr_8 collection
with session_scope() as session:
        pprint(ministac.search(session, 'landsat_sr_8'))

# Add temporal filter
startDate = dt.datetime(2017, 12, 1)
with session_scope() as session:
    pprint(ministac.search(session, 'landsat_sr_8', startDate=startDate))

# Spatial filter
geom = {'coordinates': [[[-101.7, 19.59],
                         [-101.66, 19.54],
                         [-101.61, 19.56],
                         [-101.64, 19.58],
                         [-101.57, 19.63],
                         [-101.54, 19.66],
                         [-101.6, 19.68],
                         [-101.64, 19.64],
                         [-101.7, 19.59]]],
        'type': 'Polygon'}

with session_scope() as session:
    pprint(ministac.search(session, 'landsat_sr_8', geom=geom))

# Filter with cloud cover threshold
with session_scope() as session:
    pprint(ministac.search(session, 'landsat_sr_8', maxCloudCover=20))

Ackowledgements

This project received funding from CONABIO (Mexico's national commission for biodiversity research).

ministac's People

Contributors

loicdtx avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

ministac's Issues

Add function to clean a collection

A function that checks if every item in a collection is still where it's supposed to be, and optionally remove it from the database if it isn't

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.