diff --git a/.travis.yml b/.travis.yml index 57af43e..2c44a3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -dist: focal +dist: jammy language: python sudo: required cache: @@ -26,7 +26,8 @@ python: - '3.7' install: - - pip install --ignore-installed six # install six inside the venv since the system version is too old + - mkdir -p ~/.cache/pip/wheels # remove warning "Url 'file:///home/travis/.cache/pip/wheels' is ignored: it is neither a file nor a directory." + - pip install --ignore-installed setuptools pip six certifi # install packages inside the venv if the system version is too old - pip install numpy - pip install GDAL==$(gdal-config --version) --global-option=build_ext --global-option="$(gdal-config --cflags)" - pip install -r requirements.txt diff --git a/setup.py b/setup.py index cfaf5e9..c9cf6fa 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -from setuptools import setup, find_packages +from setuptools import setup, find_namespace_packages import os directory = os.path.abspath(os.path.dirname(__file__)) @@ -10,7 +10,7 @@ requirements = req.read().split('\n') setup(name='spatialist', - packages=find_packages(), + packages=find_namespace_packages(), include_package_data=True, setup_requires=['setuptools_scm'], use_scm_version=True, diff --git a/spatialist/auxil.py b/spatialist/auxil.py index c494f65..f5cfa4e 100644 --- a/spatialist/auxil.py +++ b/spatialist/auxil.py @@ -350,7 +350,7 @@ def __osr2epsg(srs): Parameters ---------- srs: :osgeo:class:`osr.SpatialReference` - a SRS to be converted + an SRS to be converted Returns ------- @@ -363,7 +363,16 @@ def __osr2epsg(srs): """ srs = srs.Clone() try: - srs.AutoIdentifyEPSG() + try: + srs.AutoIdentifyEPSG() + except RuntimeError: + # Sometimes EPSG identification might fail + # but a match exists for which it does not. + matches = srs.FindMatches() + for srs, confidence in matches: + if confidence == 100: + srs.AutoIdentifyEPSG() + break code = int(srs.GetAuthorityCode(None)) # make sure the EPSG code actually exists srsTest = osr.SpatialReference()