Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (4)
New upstream version 1.0.18
· e1ba6f19
Bas Couwenberg
authored
Feb 08, 2019
e1ba6f19
Merge tag 'upstream/1.0.18'
· 2ce872cb
Bas Couwenberg
authored
Feb 08, 2019
Upstream version 1.0.18
2ce872cb
New upstream release.
· 3058e3e2
Bas Couwenberg
authored
Feb 08, 2019
3058e3e2
Set distribution to unstable.
· f789f413
Bas Couwenberg
authored
Feb 08, 2019
f789f413
Show whitespace changes
Inline
Side-by-side
CHANGES.txt
View file @
f789f413
Changes
=======
1.0.18 (2019-02-07)
-------------------
- Fix a regression reported in #1623.
1.0.17 (2019-02-05)
-------------------
...
...
debian/changelog
View file @
f789f413
rasterio (1.0.18-1) unstable; urgency=medium
* Team upload.
* New upstream release.
-- Bas Couwenberg <sebastic@debian.org> Fri, 08 Feb 2019 07:03:16 +0100
rasterio (1.0.17-1) unstable; urgency=medium
* Team upload.
...
...
rasterio/__init__.py
View file @
f789f413
...
...
@@ -42,7 +42,7 @@ import rasterio.path
__all__
=
[
'
band
'
,
'
open
'
,
'
pad
'
,
'
Env
'
]
__version__
=
"
1.0.1
7
"
__version__
=
"
1.0.1
8
"
__gdal_version__
=
gdal_version
()
# Rasterio attaches NullHandler to the 'rasterio' logger and its
...
...
rasterio/_crs.pyx
View file @
f789f413
...
...
@@ -130,8 +130,8 @@ cdef class _CRS(object):
finally
:
_safe_osr_release
(
osr
)
@
class
method
def
from_epsg
(
cls
,
code
):
@
static
method
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
View file @
f789f413
...
...
@@ -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
View file @
f789f413
...
...
@@ -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
'
)
...
...