<s> import string <EOL> from optparse import OptionParser <EOL> units = <NUM_LIT> <EOL> tilesize = <NUM_LIT> <EOL> pixelsize = <NUM_LIT> <EOL> def twmsbox2wmts ( request_bbox ) : <EOL> """<STR_LIT>""" <EOL> request_bbox = request_bbox . split ( "<STR_LIT:U+002C>" ) <EOL> request_minx = float ( request_bbox [ <NUM_LIT:0> ] ) <EOL> request_miny = float ( request_bbox [ <NUM_LIT:1> ] ) <EOL> request_maxx = float ( request_bbox [ <NUM_LIT:2> ] ) <EOL> request_maxy = float ( request_bbox [ <NUM_LIT:3> ] ) <EOL> x_size = request_maxx - request_minx <EOL> y_size = request_maxy - request_miny <EOL> top_left_minx = - <NUM_LIT> <EOL> top_left_maxy = <NUM_LIT> <EOL> top_left_maxx = top_left_minx + x_size <EOL> top_left_miny = top_left_maxy - y_size <EOL> print "<STR_LIT>" , str ( top_left_minx ) + "<STR_LIT:U+002C>" + str ( top_left_miny ) + "<STR_LIT:U+002C>" + str ( top_left_maxx ) + "<STR_LIT:U+002C>" + str ( top_left_maxy ) <EOL> print "<STR_LIT>" , str ( request_minx ) + "<STR_LIT:U+002C>" + str ( request_miny ) + "<STR_LIT:U+002C>" + str ( request_maxx ) + "<STR_LIT:U+002C>" + str ( request_maxy ) <EOL> col = ( ( request_minx - top_left_minx ) / x_size ) <EOL> row = ( ( request_miny - top_left_miny ) / y_size ) <EOL> scale_denominator = ( ( ( x_size * <NUM_LIT:2> ) / pixelsize ) * units ) / ( tilesize * <NUM_LIT:2> ) <EOL> print "<STR_LIT>" , str ( round ( scale_denominator , <NUM_LIT:10> ) ) <EOL> return "<STR_LIT>" + str ( abs ( int ( col ) ) ) + "<STR_LIT:\n>" + "<STR_LIT>" + str ( abs ( int ( row ) ) ) <EOL> versionNumber = '<STR_LIT>' <EOL> usageText = '<STR_LIT>' <EOL> parser = OptionParser ( usage = usageText , version = versionNumber ) <EOL> parser . add_option ( '<STR_LIT>' , '<STR_LIT>' , <EOL> action = '<STR_LIT:store>' , type = '<STR_LIT:string>' , dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> ( options , args ) = parser . parse_args ( ) <EOL> if not options . request_bbox : <EOL> parser . error ( '<STR_LIT>' ) <EOL> print ( twmsbox2wmts ( options . request_bbox ) ) </s>
