How to use the cligj.features_in_arg function in cligj

To help you get started, we’ve selected a few cligj examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mapbox / geojson-quirks / geojson_quirks / scripts / cli.py View on Github external
@cligj.features_in_arg
@cligj.sequence_opt
@cligj.use_rs_opt
@click.option("--gather-properties", default=False, is_flag=True,
              help="any non-standard keys will be moved to Features.properties")
@click.option("--flatten", default=False, is_flag=True,
              help="flatten Feature.properties")
@click.option("--string-id", default=False, is_flag=True,
              help="casts the Feature.id (if exists) to a string")
@click.option("--add-id", default=False, is_flag=True,
              help="add an auto-incrementing integer as the Feature.id")
@click.option("--add-uuid", default=False, is_flag=True,
              help="add a unique string identifier as the Feature.id")
@click.option("--add-id-from-property", nargs=1, default=False,
              help="add a Feature.id from specified Feature.properties object")
@click.option("--override-id", default=False, is_flag=True,
              help="Allow options that manipulate Feature.id to overwrite")
github mapbox / mapbox-cli-py / mapboxcli / scripts / directions.py View on Github external
@cligj.features_in_arg
@click.option('--profile', default="mapbox.driving",
              type=click.Choice(mapbox.Directions().valid_profiles),
              help="Mapbox direction profile id")
@click.option('--alternatives/--no-alternatives', default=True,
              help="Generate alternative routes?")
@click.option('--instructions', default="text",
              type=click.Choice(mapbox.Directions().valid_instruction_formats),
              help="Format for route instructions")
@click.option('--geometry', default="geojson",
              type=click.Choice(mapbox.Directions().valid_geom_encoding),
              help="Geometry encoding")
@click.option('--steps/--no-steps', default=True,
              help="Include steps in the response")
@click.option('--geojson/--no-geojson', default=False,
              help="Return geojson feature collection (default: full response json)")
@click.option('--output', '-o', default='-',
github mapbox / tilesets-cli / mapbox_tilesets / scripts / cli.py View on Github external
@cligj.features_in_arg
def validate_source(features):
    """Validate your source file.
    $ tilesets validate-source 
github perrygeo / optimal_tour / optimal_tour.py View on Github external
@cligj.features_in_arg
@click.option("--mode", default="geodesic",
              type=click.Choice(['geodesic', 'cartesian', 'directions']),
              help="Mode for calculating travel costs between points")
@click.option('--profile', default="driving",
              type=click.Choice(mapbox.Distance().valid_profiles),
              help="Mapbox profile if using directions")
@click.option("--solver", default="concorde", type=click.Choice(("lkh", "concorde")),
              help="TSP Solver to use")
@click.option('--out-points/--no-out-points', default=True,
              help="output points along with tour linestring")
def optimal_tour(features, mode, profile, out_points, solver):
    """
    A command line interface for solving the traveling salesman problem

    Input geojson features with point geometries
    and output the optimal tour as geojson feature collection.
github mapbox / tilesets-cli / mapbox_tilesets / scripts / cli.py View on Github external
@cligj.features_in_arg
@click.option("--no-validation", is_flag=True, help="Bypass source file validation")
@click.option("--quiet", is_flag=True, help="Don't show progress bar")
@click.option("--token", "-t", required=False, type=str, help="Mapbox access token")
@click.option("--indent", type=int, default=None, help="Indent for JSON output")
@click.pass_context
def add_source(
    ctx, username, id, features, no_validation, quiet, token=None, indent=None
):
    """Create/add a tileset source

    tilesets add-source   
github mapbox / mapbox-cli-py / mapboxcli / scripts / mapmatching.py View on Github external
@cligj.features_in_arg
@click.option("--gps-precision", default=4, type=int,
              help="Assumed precision of tracking device (default 4 meters)")
@click.option('--profile', default="mapbox.driving",
              type=click.Choice(mapbox.MapMatcher().valid_profiles),
              help="Mapbox profile id")
@click.pass_context
def match(ctx, features, profile, gps_precision):
    """Mapbox Map Matching API lets you use snap your GPS traces
to the OpenStreetMap road and path network.

      $ mapbox mapmatching trace.geojson

An access token is required, see `mapbox --help`.
    """
    access_token = (ctx.obj and ctx.obj.get('access_token')) or None
github mapbox / supermercado / supermercado / scripts / cli.py View on Github external
@cligj.features_in_arg
@cligj.sequence_opt
@click.argument('zoom', type=int)
def burn(features, sequence, zoom):
    """
    Burn a stream of GeoJSONs into a output stream of the tiles they intersect for a given zoom.
    """
    features = [f for f in super_utils.filter_polygons(features)]

    tiles = burntiles.burn(features, zoom)
    for t in tiles:
        click.echo(t.tolist())
github mapbox / mapbox-cli-py / mapboxcli / scripts / distance.py View on Github external
@cligj.features_in_arg
@click.option('--profile', default="driving",
              type=click.Choice(mapbox.Distance().valid_profiles),
              help="Mapbox direction profile id")
@click.option('--output', '-o', default='-',
              help="Save output to a file.")
@click.pass_context
def distance(ctx, features, profile, output):
    """The Distance API returns all travel times between
    many points (also known as Distance Matrix). This is often
    used as input for solving routing optimization problems.

      $ mapbox distance "[-122.681, 45.528]" "[-122.716, 45.525]"

    The output is a json object with a "durations" key
    containing a 2D array of travel times between waypoints.
github perrygeo / python-rasterstats / src / rasterstats / cli.py View on Github external
@cligj.features_in_arg
@click.version_option(version=version, message='%(version)s')
@click.option('--raster', '-r', required=True)
@click.option('--all-touched/--no-all-touched', default=False)
@click.option('--band', type=int, default=1)
@click.option('--categorical/--no-categorical', default=False)
@click.option('--indent', type=int, default=None)
@click.option('--info/--no-info', default=False)
@click.option('--nodata', type=int, default=None)
@click.option('--prefix', type=str, default='_')
@click.option('--stats', type=str, default=None)
@cligj.sequence_opt
@cligj.use_rs_opt
def zonalstats(features, raster, all_touched, band, categorical,
               indent, info, nodata, prefix, stats, sequence, use_rs):
    '''zonalstats generates summary statistics of geospatial raster datasets
    based on vector features.
github Toblerity / Fiona / fiona / fio / load.py View on Github external
@cligj.features_in_arg
@click.option('--layer', metavar="INDEX|NAME", callback=options.cb_layer,
              help="Load features into specified layer.  Layers use "
                   "zero-based numbering when accessed by index.")
@click.pass_context
@with_context_env
def load(ctx, output, driver, src_crs, dst_crs, features, layer):
    """Load features from JSON to a file in another format.

    The input is a GeoJSON feature collection or optionally a sequence of
    GeoJSON feature objects.
    """
    logger = logging.getLogger(__name__)

    dst_crs = dst_crs or src_crs

    if src_crs and dst_crs and src_crs != dst_crs: