Skip to content

Commit

Permalink
don't expect a prefix EPSG: before a EPSG code
Browse files Browse the repository at this point in the history
  • Loading branch information
Nakaner committed Feb 14, 2018
1 parent 30e50f8 commit da68a76
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions nik4.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def correct_scale(bbox_web_merc, bbox_target):
parser.add_argument('--add-layers', help='Map layers to include, comma-separated')
parser.add_argument('--hide-layers', help='Map layers to hide, comma-separated')

parser.add_argument('-P', '--projection', help='EPSG code as EPSG:1234 or Proj4 string', default=EPSG_3857)
parser.add_argument('-P', '--projection', help='EPSG code as 1234 (without prefix "EPSG:" or Proj4 string', default=EPSG_3857)

parser.add_argument('--url', help='URL of a map to center on')
parser.add_argument('--ozi', type=argparse.FileType('w'), help='Generate ozi map file')
Expand Down Expand Up @@ -248,12 +248,12 @@ def correct_scale(bbox_web_merc, bbox_target):
need_cairo = fmt in ['svg', 'pdf']

# output projection
if options.projection.lower().startswith('epsg:'):
proj_target = mapnik.Projection('+init={}'.format(options.projection.lower()))
if options.projection.isdigit():
proj_target = mapnik.Projection('+init=epsg:{}'.format(options.projection))
else:
proj_target = mapnik.Projection(options.projection.lower())
proj_target = mapnik.Projection(options.projection)
transform = mapnik.ProjTransform(proj_lonlat, proj_target)

# get image size in millimeters
if options.paper:
portrait = False
Expand Down

0 comments on commit da68a76

Please sign in to comment.