[Git][debian-gis-team/rasterio][master] 4 commits: New upstream version 1.0.18
Bas Couwenberg
gitlab at salsa.debian.org
Fri Feb 8 06:26:41 GMT 2019
Bas Couwenberg pushed to branch master at Debian GIS Project / rasterio
Commits:
e1ba6f19 by Bas Couwenberg at 2019-02-08T06:02:25Z
New upstream version 1.0.18
- - - - -
2ce872cb by Bas Couwenberg at 2019-02-08T06:02:30Z
Merge tag 'upstream/1.0.18'
Upstream version 1.0.18
- - - - -
3058e3e2 by Bas Couwenberg at 2019-02-08T06:02:48Z
New upstream release.
- - - - -
f789f413 by Bas Couwenberg at 2019-02-08T06:03:24Z
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.18 (2019-02-07)
+-------------------
+
+- Fix a regression reported in #1623.
+
1.0.17 (2019-02-05)
-------------------
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+rasterio (1.0.18-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream release.
+
+ -- Bas Couwenberg <sebastic at debian.org> Fri, 08 Feb 2019 07:03:16 +0100
+
rasterio (1.0.17-1) unstable; urgency=medium
* Team upload.
=====================================
rasterio/__init__.py
=====================================
@@ -42,7 +42,7 @@ import rasterio.path
__all__ = ['band', 'open', 'pad', 'Env']
-__version__ = "1.0.17"
+__version__ = "1.0.18"
__gdal_version__ = gdal_version()
# Rasterio attaches NullHandler to the 'rasterio' logger and its
=====================================
rasterio/_crs.pyx
=====================================
@@ -130,8 +130,8 @@ cdef class _CRS(object):
finally:
_safe_osr_release(osr)
- @classmethod
- def from_epsg(cls, code):
+ @staticmethod
+ def from_epsg(code):
"""Make a CRS from an EPSG code
Parameters
@@ -148,9 +148,19 @@ cdef class _CRS(object):
CRS
"""
- if int(code) <= 0:
+ cdef _CRS obj = _CRS.__new__(_CRS)
+
+ code = int(code)
+
+ if code <= 0:
raise CRSError("EPSG codes are positive integers")
- return cls.from_proj4('+init=epsg:{}'.format(code))
+
+ try:
+ exc_wrap_ogrerr(exc_wrap_int(OSRImportFromEPSG(obj._osr, <int>code)))
+ except CPLE_BaseError as exc:
+ raise CRSError("The EPSG code is unknown. {}".format(exc))
+ else:
+ return obj
@staticmethod
def from_proj4(proj):
@@ -168,7 +178,7 @@ cdef class _CRS(object):
"""
cdef _CRS obj = _CRS.__new__(_CRS)
- # Filter out nonsensical items.
+ # Filter out nonsensical items that might have crept in.
items_filtered = []
items = proj.split()
for item in items:
@@ -207,10 +217,13 @@ cdef class _CRS(object):
data.update(**kwargs)
data = {k: v for k, v in data.items() if k in all_proj_keys}
- # always use lowercase 'epsg'.
- if 'init' in data:
- data['init'] = data['init'].replace('EPSG:', 'epsg:')
+ # "+init=epsg:xxxx" is deprecated in GDAL. If we find this, we will
+ # extract the epsg code and dispatch to from_epsg.
+ if 'init' in data and data['init'].lower().startswith('epsg:'):
+ epsg_code = int(data['init'].split(':')[1])
+ return _CRS.from_epsg(epsg_code)
+ # Continue with the general case.
proj = ' '.join(['+{}={}'.format(key, val) for key, val in data.items()])
b_proj = proj.encode('utf-8')
=====================================
rasterio/crs.py
=====================================
@@ -66,23 +66,7 @@ class CRS(collections.Mapping):
data = dict(initialdata or {})
data.update(**kwargs)
data = {k: v for k, v in data.items() if k in all_proj_keys}
-
- # always use lowercase 'epsg'.
- if 'init' in data:
- data['init'] = data['init'].replace('EPSG:', 'epsg:')
-
- proj_parts = []
-
- for key, val in data.items():
- if val is False or None:
- continue
- elif val is True:
- proj_parts.append('+{}'.format(key))
- else:
- proj_parts.append('+{}={}'.format(key, val))
-
- proj = ' '.join(proj_parts)
- self._crs = _CRS.from_proj4(proj)
+ self._crs = _CRS.from_dict(data)
else:
self._crs = _CRS()
=====================================
tests/test_crs.py
=====================================
@@ -42,21 +42,21 @@ def test_crs_constructor_dict():
"""Can create a CRS from a dict"""
crs = CRS({'init': 'epsg:3857'})
assert crs['init'] == 'epsg:3857'
- assert 'PROJCS["unnamed",GEOGCS["unnamed ellipse",DATUM["unknown",SPHEROID["unnamed",6378137,0]' in crs.wkt
+ assert '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"]]' in crs.wkt
def test_crs_constructor_keywords():
"""Can create a CRS from keyword args, ignoring unknowns"""
crs = CRS(init='epsg:3857', foo='bar')
assert crs['init'] == 'epsg:3857'
- assert 'PROJCS["unnamed",GEOGCS["unnamed ellipse",DATUM["unknown",SPHEROID["unnamed",6378137,0]' in crs.wkt
+ assert '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"]]' in crs.wkt
def test_crs_constructor_crs_obj():
"""Can create a CRS from a CRS obj"""
crs = CRS(CRS(init='epsg:3857'))
assert crs['init'] == 'epsg:3857'
- assert 'PROJCS["unnamed",GEOGCS["unnamed ellipse",DATUM["unknown",SPHEROID["unnamed",6378137,0]' in crs.wkt
+ assert '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"]]' in crs.wkt
@pytest.fixture(scope='session')
View it on GitLab: https://salsa.debian.org/debian-gis-team/rasterio/compare/4e3ac6c3ff5f5202dccac2a365c8f7cca05737b8...f789f413e5a671ed01054db59a254bc2dd145108
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/rasterio/compare/4e3ac6c3ff5f5202dccac2a365c8f7cca05737b8...f789f413e5a671ed01054db59a254bc2dd145108
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/20190208/66eafd5b/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list