Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@cligj.quiet_opt
def cmd(quiet):
click.echo("%s" % quiet)
@quiet_opt
def info(dataset, indent, meta_member, verbose, quiet):
"""Print basic metadata about a DataBC WFS layer as JSON.
Optionally print a single metadata item as a string.
"""
verbosity = verbose - quiet
configure_logging(verbosity)
table = bcdata.validate_name(dataset)
wfs = WebFeatureService(url=bcdata.OWS_URL, version="2.0.0")
info = {}
info["name"] = table
info["count"] = bcdata.get_count(table)
info["schema"] = wfs.get_schema("pub:" + table)
if meta_member:
click.echo(info[meta_member])
else:
@quiet_opt
def cat(
dataset,
query,
bounds,
bounds_crs,
indent,
compact,
dst_crs,
pagesize,
sortby,
verbose,
quiet,
):
"""Write DataBC features to stdout as GeoJSON feature objects.
"""
# Note that cat does not concatenate!
@quiet_opt
def bc2pg(
dataset,
db_url,
table,
schema,
query,
bounds,
bounds_crs,
pagesize,
max_workers,
dim,
fid,
append,
verbose,
quiet,
):
@cligj.quiet_opt
@click.option('--access-token', help="Your Mapbox access token.")
@click.version_option(version=mapbox.__version__, message='%(version)s')
@click.pass_context
def main_group(ctx, verbose, quiet, access_token):
"""This is the command line interface to Mapbox web services.
Mapbox web services require an access token. Your token is shown
on the https://www.mapbox.com/developers/api/ page when you are
logged in. The token can be provided on the command line
$ mbx --access-token MY_TOKEN ...
or as an environment variable named MAPBOX_ACCESS_TOKEN or
MapboxAccessToken.
\b
@quiet_opt
def dem(
bounds, bounds_crs, dst_crs, out_file, resolution, interpolation, verbose, quiet
):
"""Dump BC DEM to TIFF
"""
verbosity = verbose - quiet
configure_logging(verbosity)
if not dst_crs:
dst_crs = "EPSG:3005"
bcdata.get_dem(
bounds,
out_file=out_file,
src_crs=bounds_crs,
dst_crs=dst_crs,
resolution=resolution,
interpolation=interpolation,
@quiet_opt
def dump(dataset, query, out_file, bounds, bounds_crs, verbose, quiet):
"""Write DataBC features to stdout as GeoJSON feature collection.
\b
$ bcdata dump bc-airports
$ bcdata dump bc-airports --query "AIRPORT_NAME='Victoria Harbour (Shoal Point) Heliport'"
$ bcdata dump bc-airports --bounds xmin ymin xmax ymax
It can also be combined to read bounds of a feature dataset using Fiona:
\b
$ bcdata dump bc-airports --bounds $(fio info aoi.shp --bounds)
"""
verbosity = verbose - quiet
configure_logging(verbosity)
table = bcdata.validate_name(dataset)
@cligj.quiet_opt
@click.option('--access-token', help="Your Mapbox access token.")
@click.option('--config', '-c', type=click.Path(exists=True,
resolve_path=True),
help="Config file (default: '{0}/mapbox.ini'".format(
click.get_app_dir('mapbox')))
@click.pass_context
def main_group(ctx, verbose, quiet, access_token, config):
"""This is the command line interface to Mapbox web services.
Mapbox web services require an access token. Your token is shown
on the https://www.mapbox.com/studio/account/tokens/ page when you are
logged in. The token can be provided on the command line
$ mapbox --access-token MY_TOKEN ...
as an environment variable named MAPBOX_ACCESS_TOKEN (higher
@cligj.quiet_opt
@click.option('--aws-profile',
help="Selects a profile from your shared AWS credentials file")
@click.version_option(version=rasterio.__version__, message='%(version)s')
@click.option('--gdal-version', is_eager=True, is_flag=True,
callback=gdal_version_cb)
@click.pass_context
def main_group(ctx, verbose, quiet, aws_profile, gdal_version):
"""Rasterio command line interface.
"""
verbosity = verbose - quiet
configure_logging(verbosity)
ctx.obj = {}
ctx.obj['verbosity'] = verbosity
ctx.obj['aws_profile'] = aws_profile
ctx.obj['env'] = rasterio.Env(CPL_DEBUG=(verbosity > 2),
profile_name=aws_profile)
@quiet_opt
@click.option('--version', is_flag=True, callback=print_version,
expose_value=False, is_eager=True,
help="Print Fiona version.")
@click.pass_context
def cli(ctx, verbose, quiet):
verbosity = verbose - quiet
configure_logging(verbosity)
ctx.obj = {}
ctx.obj['verbosity'] = verbosity