From 75b94ee34f24f83c9b206731f5df19cde2037ad7 Mon Sep 17 00:00:00 2001 From: johntruckenbrodt Date: Fri, 9 Sep 2022 16:47:15 +0200 Subject: [PATCH 1/3] [auxil.__osr2epsg] improved EPSG code search --- spatialist/auxil.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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() From d13b96fa06cb9b338ad753eec81ee787531ab6f2 Mon Sep 17 00:00:00 2001 From: johntruckenbrodt Date: Fri, 9 Sep 2022 17:06:06 +0200 Subject: [PATCH 2/3] [setup] find_packages -> find_namespace_packages --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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, From 9073c07a606f4e7cedeb98f780c74ed10965fa0f Mon Sep 17 00:00:00 2001 From: johntruckenbrodt Date: Fri, 9 Sep 2022 17:06:25 +0200 Subject: [PATCH 3/3] [travis] installation fixes --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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