Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distinguish handle of projections #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions tilemapbase/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import math as _math
import PIL.Image as _Image
from pkg_resources import parse_version

_EPSG_RESCALE = 20037508.342789244

Expand Down Expand Up @@ -505,10 +506,15 @@ def _parse_crs(crs):
if crs is None:
return _NATIVE_LONLAT
try:
parts = crs["init"].split(":")
if parts[0].upper() != "EPSG":
raise ValueError("Unknown projection '{}'".format(crs["init"]))
code = int(parts[1])
vers = pyproj.__version__
#print("Version{}".format(test2))
if parse_version(vers) > parse_version('2.6.1.post1'):
code = int(crs.to_epsg())
else:
parts = crs["init"].split(":")
if parts[0].upper() != "EPSG":
raise ValueError("Unknown projection '{}'".format(crs["init"]))
code = int(parts[1])
if code == _NATIVE_LONLAT:
return _NATIVE_LONLAT
if code == 3857 or code == 3785:
Expand Down