Commit 40dbf777 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Bugfix prj_equal: Removed superfluous projection comparison, improved type hint.

parent 1e27d72e
Pipeline #1070 passed with stages
in 1 minute
...@@ -7,8 +7,8 @@ from . import numeric ...@@ -7,8 +7,8 @@ from . import numeric
from . import similarity from . import similarity
from . import web from . import web
__version__ = '0.4.4' __version__ = '0.4.5'
__versionalias__ = '20170909_01' __versionalias__ = '20170911_01'
__author__='Daniel Scheffler' __author__='Daniel Scheffler'
# Validate GDAL version # Validate GDAL version
......
...@@ -5,6 +5,7 @@ __author__ = "Daniel Scheffler" ...@@ -5,6 +5,7 @@ __author__ = "Daniel Scheffler"
import re import re
import os import os
import pyproj import pyproj
from typing import Union
# custom # custom
try: try:
...@@ -70,17 +71,23 @@ def proj4_to_WKT(proj4str): ...@@ -70,17 +71,23 @@ def proj4_to_WKT(proj4str):
def prj_equal(prj1, prj2): def prj_equal(prj1, prj2):
#type: (any,any) -> bool # type: (Union[None, int, str], Union[None, int, str]) -> bool
"""Checks if the given two projections are equal. """Checks if the given two projections are equal.
:param prj1: projection 1 (WKT or 'epsg:1234' or <EPSG_int>) :param prj1: projection 1 (WKT or 'epsg:1234' or <EPSG_int>)
:param prj2: projection 2 (WKT or 'epsg:1234' or <EPSG_int>) :param prj2: projection 2 (WKT or 'epsg:1234' or <EPSG_int>)
""" """
return get_proj4info(proj=prj1)==get_proj4info(proj=prj2) if prj1 is None and prj2 is None or prj1 == prj2:
return True
else:
return get_proj4info(proj=prj1)==get_proj4info(proj=prj2)
def isProjectedOrGeographic(prj): def isProjectedOrGeographic(prj):
""":param prj: accepts EPSG, Proj4 and WKT projections""" """
:param prj: accepts EPSG, Proj4 and WKT projections#
"""
if prj is None: return None if prj is None: return None
srs = osr.SpatialReference() srs = osr.SpatialReference()
if prj.startswith('EPSG:'): if prj.startswith('EPSG:'):
......
...@@ -17,7 +17,7 @@ test_requirements = requirements + ['coverage'] ...@@ -17,7 +17,7 @@ test_requirements = requirements + ['coverage']
setup( setup(
name='py_tools_ds', name='py_tools_ds',
version='0.4.4', version='0.4.5',
description="A collection of Python tools by Daniel Scheffler.", description="A collection of Python tools by Daniel Scheffler.",
long_description=readme + '\n\n' + history, long_description=readme + '\n\n' + history,
author="Daniel Scheffler", author="Daniel Scheffler",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment