2019-12-11 13:22:28 +01:00
|
|
|
# encoding: utf-8
|
|
|
|
import click
|
|
|
|
import logging
|
|
|
|
|
|
|
|
import ckanext.spatial.util as util
|
|
|
|
|
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
2019-12-13 15:48:20 +01:00
|
|
|
def get_commands():
|
|
|
|
return [
|
|
|
|
spatial,
|
|
|
|
spatial_validation
|
|
|
|
]
|
2019-12-11 13:22:28 +01:00
|
|
|
|
|
|
|
|
2019-12-13 15:48:20 +01:00
|
|
|
@click.group(u"spatial-validation", short_help=u"Validation commands")
|
|
|
|
def spatial_validation():
|
|
|
|
pass
|
2019-12-11 13:22:28 +01:00
|
|
|
|
2019-12-13 15:48:20 +01:00
|
|
|
|
|
|
|
@spatial_validation.command()
|
2019-12-11 13:22:28 +01:00
|
|
|
@click.argument('pkg', required=False)
|
|
|
|
def report(pkg):
|
|
|
|
return util.report(pkg)
|
|
|
|
|
|
|
|
|
2019-12-13 15:48:20 +01:00
|
|
|
@spatial_validation.command('report-csv')
|
2019-12-11 13:22:28 +01:00
|
|
|
@click.argument('filepath')
|
|
|
|
def report_csv(filepath):
|
|
|
|
return util.report_csv(filepath)
|
|
|
|
|
|
|
|
|
2019-12-13 15:48:20 +01:00
|
|
|
@spatial_validation.command('file')
|
2019-12-11 13:22:28 +01:00
|
|
|
@click.argument('filepath')
|
|
|
|
def validate_file(filepath):
|
|
|
|
return util.validate_file(filepath)
|
|
|
|
|
|
|
|
|
|
|
|
@click.group(short_help=u"Performs spatially related operations.")
|
2019-12-13 15:48:20 +01:00
|
|
|
def spatial():
|
|
|
|
pass
|
2019-12-11 13:22:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
@spatial.command()
|
|
|
|
@click.argument('srid', required=False)
|
|
|
|
def initdb(srid):
|
|
|
|
return util.initdb(srid)
|
|
|
|
|
|
|
|
|
|
|
|
@spatial.command('extents')
|
|
|
|
def update_extents():
|
|
|
|
return util.update_extents()
|