Skip to content

Commit

Permalink
Adding to hack in SpatialReference.GetEPSGCode to also check for QGIS…
Browse files Browse the repository at this point in the history
… style PROJCS name.
  • Loading branch information
chewthemonkey committed Sep 13, 2022
1 parent 514f4f2 commit 8832a3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion gdal2mbtiles/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
# EPSG constants
EPSG_WEB_MERCATOR = 3857

# ESRI constants with their EPSG code equivalent
# ESRI / QGIS constants with their EPSG code equivalent
ESRI_102113_PROJ = 'WGS_1984_Web_Mercator' # EPSG:3785
ESRI_102100_PROJ = 'WGS_1984_Web_Mercator_Auxiliary_Sphere' # EPSG:3857
QGIS_3857_PROJ = 'WGS 84 / Pseudo-Mercator' # EPSG:3857

# Output constants
TILE_SIDE = 256 # in pixels
Expand Down
4 changes: 2 additions & 2 deletions gdal2mbtiles/gdal.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@


from .constants import (EPSG_WEB_MERCATOR, ESRI_102113_PROJ, ESRI_102100_PROJ,
GDALTRANSLATE, GDALWARP, TILE_SIDE)
GDALTRANSLATE, GDALWARP, QGIS_3857_PROJ, TILE_SIDE)
from .exceptions import (GdalError, CalledGdalError, UnalignedInputError,
UnknownResamplingMethodError)
from .gd_types import Extents, GdalFormat, XY
Expand Down Expand Up @@ -819,7 +819,7 @@ def GetEPSGCode(self):
# 'mercator_auxiliary_sphere' projection name.
projcs_name = self.GetAttrValue(str('PROJCS'))
# Returning equivalent EPSG code
if projcs_name == ESRI_102100_PROJ:
if projcs_name in (ESRI_102100_PROJ, QGIS_3857_PROJ):
return 3857
elif projcs_name == ESRI_102113_PROJ:
return 3785
Expand Down

0 comments on commit 8832a3b

Please sign in to comment.