[Git][debian-gis-team/rasterio][master] 4 commits: New upstream version 1.0.17
Bas Couwenberg
gitlab at salsa.debian.org
Wed Feb 6 06:58:44 GMT 2019
Bas Couwenberg pushed to branch master at Debian GIS Project / rasterio
Commits:
3c8c2bf2 by Bas Couwenberg at 2019-02-06T06:40:31Z
New upstream version 1.0.17
- - - - -
3efc0f9d by Bas Couwenberg at 2019-02-06T06:40:35Z
Merge tag 'upstream/1.0.17'
Upstream version 1.0.17
- - - - -
e2c79a48 by Bas Couwenberg at 2019-02-06T06:40:50Z
New upstream release.
- - - - -
4e3ac6c3 by Bas Couwenberg at 2019-02-06T06:41:19Z
Set distribution to unstable.
- - - - -
6 changed files:
- CHANGES.txt
- debian/changelog
- rasterio/__init__.py
- rasterio/_crs.pyx
- rasterio/crs.py
- tests/test_crs.py
Changes:
=====================================
CHANGES.txt
=====================================
@@ -1,6 +1,11 @@
Changes
=======
+1.0.17 (2019-02-05)
+-------------------
+
+- Fix a regression in evaluation of CRS equality (#1620).
+
1.0.16 (2019-02-04)
-------------------
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+rasterio (1.0.17-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream release.
+
+ -- Bas Couwenberg <sebastic at debian.org> Wed, 06 Feb 2019 07:41:11 +0100
+
rasterio (1.0.16-1) unstable; urgency=medium
* Team upload.
=====================================
rasterio/__init__.py
=====================================
@@ -42,7 +42,7 @@ import rasterio.path
__all__ = ['band', 'open', 'pad', 'Env']
-__version__ = "1.0.16"
+__version__ = "1.0.17"
__gdal_version__ = gdal_version()
# Rasterio attaches NullHandler to the 'rasterio' logger and its
=====================================
rasterio/_crs.pyx
=====================================
@@ -58,16 +58,23 @@ cdef class _CRS(object):
cdef OGRSpatialReferenceH osr_o = NULL
cdef _CRS crs_o = other
- try:
- osr_s = exc_wrap_pointer(OSRClone(self._osr))
- exc_wrap_ogrerr(OSRMorphFromESRI(osr_s))
- osr_o = exc_wrap_pointer(OSRClone(crs_o._osr))
- exc_wrap_ogrerr(OSRMorphFromESRI(osr_o))
- return bool(OSRIsSame(osr_s, osr_o) == 1)
+ epsg_s = self.to_epsg()
+ epsg_o = other.to_epsg()
- finally:
- _safe_osr_release(osr_s)
- _safe_osr_release(osr_o)
+ if epsg_s is not None and epsg_o is not None and epsg_s == epsg_o:
+ return True
+
+ else:
+ try:
+ osr_s = exc_wrap_pointer(OSRClone(self._osr))
+ exc_wrap_ogrerr(OSRMorphFromESRI(osr_s))
+ osr_o = exc_wrap_pointer(OSRClone(crs_o._osr))
+ exc_wrap_ogrerr(OSRMorphFromESRI(osr_o))
+ return bool(OSRIsSame(osr_s, osr_o) == 1)
+
+ finally:
+ _safe_osr_release(osr_s)
+ _safe_osr_release(osr_o)
def to_wkt(self, morph_to_esri_dialect=False):
"""An OGC WKT representation of the CRS
@@ -252,6 +259,42 @@ cdef class _CRS(object):
else:
return obj
+ @staticmethod
+ def from_user_input(text, morph_from_esri_dialect=False):
+ """Make a CRS from a WKT string
+
+ Parameters
+ ----------
+ text : str
+ User input text of many different kinds.
+ morph_from_esri_dialect : bool, optional
+ If True, items in the input using Esri's dialect of WKT
+ will be replaced by OGC standard equivalents.
+
+ Returns
+ -------
+ CRS
+
+ """
+ cdef const char *text_c = NULL
+
+ if not isinstance(text, string_types):
+ raise ValueError("A string is expected")
+
+ text_b = text.encode('utf-8')
+ text_c = text_b
+
+ cdef _CRS obj = _CRS.__new__(_CRS)
+
+ try:
+ errcode = exc_wrap_ogrerr(OSRSetFromUserInput(obj._osr, text_c))
+ if morph_from_esri_dialect:
+ exc_wrap_ogrerr(OSRMorphFromESRI(obj._osr))
+ except CPLE_BaseError as exc:
+ raise CRSError("The WKT could not be parsed. {}".format(exc))
+ else:
+ return obj
+
def to_dict(self):
"""Convert CRS to a PROJ4 dict
=====================================
rasterio/crs.py
=====================================
@@ -421,6 +421,8 @@ class CRS(collections.Mapping):
elif isinstance(value, dict):
return cls(**value)
elif isinstance(value, string_types):
- return cls.from_string(value, morph_from_esri_dialect=morph_from_esri_dialect)
+ obj = cls()
+ obj._crs = _CRS.from_user_input(value, morph_from_esri_dialect=morph_from_esri_dialect)
+ return obj
else:
raise CRSError("CRS is invalid: {!r}".format(value))
=====================================
tests/test_crs.py
=====================================
@@ -425,4 +425,9 @@ def test_issue1609_wktext_b():
def test_empty_crs_str():
"""str(CRS()) should be empty string"""
- assert str(CRS()) == ''
\ No newline at end of file
+ assert str(CRS()) == ''
+
+
+def test_issue1620():
+ """Different forms of EPSG:3857 are equal"""
+ assert CRS.from_wkt('PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","3857"]]') == CRS.from_dict(init='epsg:3857')
View it on GitLab: https://salsa.debian.org/debian-gis-team/rasterio/compare/0be70014da1eb175f9c051c60ae4984cd958edef...4e3ac6c3ff5f5202dccac2a365c8f7cca05737b8
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/rasterio/compare/0be70014da1eb175f9c051c60ae4984cd958edef...4e3ac6c3ff5f5202dccac2a365c8f7cca05737b8
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20190206/8016fb3d/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list