Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(0)  |  Derive(0)  |  Import(2)

        def scales_command(args=None):
    parser = optparse.OptionParser("%prog scales [options] scale/resolution[, ...]")
    parser.add_option("-l", "--levels", default=1, type=int, metavar='1',
        help="number of resolutions/scales to calculate")
    parser.add_option("-d", "--dpi", default='OGC',
        help="DPI to convert scales (use OGC for .28mm based DPI)")
    parser.add_option("--unit", default='m', metavar='m',
        help="use resolutions in meter (m) or degrees (d)")
    parser.add_option("--eval", default=False, action='store_true',
        help="evaluate args as Python expression. For example: 360/256")
    parser.add_option("--repeat", default=False, action='store_true',
        help="repeat all values, each time /10. For example: 1000 500 250 results in 1000 500 250 100 50 25 10...")
    parser.add_option("--res-to-scale", default=False, action='store_true',
        help="convert resolutions to scale")
    parser.add_option("--as-res-config", default=False, action='store_true',
        help="output as resolution list for MapProxy grid configuration")

    if args:
        args = args[1:] # remove script name
    (options, args) = parser.parse_args(args)
    options.levels = max(options.levels, len(args))

    dpi = float(DEFAULT_DPIS.get(options.dpi, options.dpi))

    if not args:
        parser.print_help()
        sys.exit(1)

    if args[0] == '-':
        values = values_from_stdin()
    elif options.eval:
        values = map(eval, args)
    else:
        values = map(float, args)

    values.sort(reverse=True)

    if options.repeat:
        values = repeated_values(values, options.levels)

    if len(values) < options.levels:
        values = fill_values(values, options.levels)

    unit_factor = 1
    if options.unit == 'd':
        # calculated from well-known scale set GoogleCRS84Quad
        unit_factor = 111319.4907932736

    calc = scale_to_res
    if options.res_to_scale:
        calc = res_to_scale

    if options.as_res_config:
        print '    res: ['
        print '         #  res            level     scale @%.1f DPI' % dpi
        format = format_list
    else:
        format = format_simple

    for i, value in enumerate(values):
        print format(i, value, calc(value, dpi, unit_factor))

    if options.as_res_config:
        print '    ]'
        


src/m/a/MapProxy-1.6.0/mapproxy/script/util.py   MapProxy(Download)
 
from mapproxy.version import version
from mapproxy.script.scales import scales_command
from mapproxy.script.wms_capabilities import wms_capabilities_command
from mapproxy.script.grids import grids_command

src/m/a/mapproxy-HEAD/mapproxy/script/util.py   mapproxy(Download)
 
from mapproxy.version import version
from mapproxy.script.scales import scales_command
from mapproxy.script.wms_capabilities import wms_capabilities_command
from mapproxy.script.grids import grids_command