Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Build Status Join the chat at https://gitter.im/geopython/pygeometa

pygeometa

pygeometa is a Python package to generate metadata for geospatial datasets.

Installation

pygeometa is best installed and used within a Python virtualenv.

Requirements

Dependencies

Dependencies are listed in requirements.txt. Dependencies are automatically installed during pygeometa's installation.

Installing the Package

python3 -m venv my-env
cd my-env
. bin/activate
git clone https://github.com/geopython/pygeometa.git
cd pygeometa
python setup.py build
python setup.py install

Running

From the command line

# provide a basic sanity check/report on an MCF
pygeometa info --mcf=path/to/file.yml

# generate an ISO 19139 document to stdout
pygeometa generate-metadata --mcf=path/to/file.yml --schema=iso19139

# generate an ISO 19139 document to disk
pygeometa generate-metadata --mcf=path/to/file.yml --schema=iso19139 --output=some_file.xml

# generate an ISO 19139 document to disk with debugging (ERROR, WARNING, INFO, DEBUG)
pygeometa generate-metadata --mcf=path/to/file.yml --schema=iso19139 --output=some_file.xml --verbosity=DEBUG # add verbose (ERROR, WARNING, INFO, DEBUG)

# use your own defined schema
pygeometa generate-metadata --mcf=path/to/file.yml --schema_local=/path/to/my-schema --output=some_file.xml  # to file

Supported schemas

Schemas supported by pygeometa:

Using the API from Python

from pygeometa.core import render_template
# default schema
xml_string = render_template('/path/to/file.yml', schema='iso19139')
# user-defined schema
xml_string = render_template('/path/to/file.yml', schema_local='/path/to/new-schema')
# dictionary representation of YAML
xml_string = render_template(yaml_dict, schema='iso19139')
with open('output.xml', 'w') as ff:
    ff.write(xml_string)
# render from an MCF stored in a string
mcf_string = '...'  # some string
xml_string = render_template_string(mcf_string, schema='iso19139')
# render from an MCF as a ConfigParser object
mcf_cp = '...'  # some ConfigParser object
xml_string = render_template_string(mcf_cp, schema='iso19139')

Migration

Migrating old MCFs to YAML

pygeometa provides a migrate utility to convert legacy MCFs into YAML:

pygeometa migrate --mcf=path/to/file.mcf  # to stdout
pygeometa migrate --mcf=path/to/file.mcf --output=some_file.yml  # to file

The migrate utility doesn't support migrating comments from legacy MCFs tox YAML MCFs.

Development

Setting up a Development Environment

Same as installing a package. Use a virtualenv. Also install developer requirements:

pip install -r requirements-dev.txt

Adding a Metadata Schema to the Core

List of supported metadata schemas in pygeometa/templates/

To add support to new metadata schemas:

cp -r pygeometa/templates/iso19139 pygeometa/templates/new-schema

Then modify *.j2 files in the new pygeometa/templates/new-schema directory to comply to new metadata schema.

Running Tests

# via setuptools
python setup.py test
# manually
cd tests
python run_tests.py

Releasing

python setup.py sdist bdist_wheel --universal
twine upload dist/*

Code Conventions

Bugs and Issues

All bugs, enhancements and issues are managed on GitHub.

Contact

About

pygeometa is a Python package to generate metadata for geospatial datasets

Resources

License

Packages

No packages published

Languages

You can’t perform that action at this time.