[Git][debian-gis-team/fiona][upstream] New upstream version 1.8.17
Bas Couwenberg
gitlab at salsa.debian.org
Thu Sep 10 05:00:47 BST 2020
Bas Couwenberg pushed to branch upstream at Debian GIS Project / fiona
Commits:
253d7e60 by Bas Couwenberg at 2020-09-10T05:50:40+02:00
New upstream version 1.8.17
- - - - -
6 changed files:
- CHANGES.txt
- fiona/__init__.py
- fiona/fio/cat.py
- fiona/ogrext.pyx
- tests/test_fio_cat.py
- tests/test_memoryfile.py
Changes:
=====================================
CHANGES.txt
=====================================
@@ -3,6 +3,14 @@ Changes
All issue numbers are relative to https://github.com/Toblerity/Fiona/issues.
+1.8.17 (2020-09-09)
+-------------------
+
+- To fix issue #952 the fio-cat command no longer cuts feature geometries at
+ the anti-meridian by default. A --cut-at-antimeridian option has been added
+ to allow cutting of geometries in a geographic destination coordinate
+ reference system.
+
1.8.16 (2020-09-04)
-------------------
=====================================
fiona/__init__.py
=====================================
@@ -105,7 +105,7 @@ with fiona._loading.add_gdal_dll_directories():
__all__ = ['bounds', 'listlayers', 'open', 'prop_type', 'prop_width']
-__version__ = "1.8.16"
+__version__ = "1.8.17"
__gdal_version__ = get_gdal_release_name()
gdal_version = get_gdal_version_tuple()
=====================================
fiona/fio/cat.py
=====================================
@@ -31,12 +31,33 @@ warnings.simplefilter('default')
help="log errors but do not stop serialization.")
@options.dst_crs_opt
@cligj.use_rs_opt
- at click.option('--bbox', default=None, metavar="w,s,e,n",
- help="filter for features intersecting a bounding box")
+ at click.option(
+ "--bbox",
+ default=None,
+ metavar="w,s,e,n",
+ help="filter for features intersecting a bounding box",
+)
+ at click.option(
+ "--cut-at-antimeridian",
+ is_flag=True,
+ default=False,
+ help="Optionally cut geometries at the anti-meridian. To be used only for a geographic destination CRS.",
+)
@click.pass_context
@with_context_env
-def cat(ctx, files, precision, indent, compact, ignore_errors, dst_crs,
- use_rs, bbox, layer):
+def cat(
+ ctx,
+ files,
+ precision,
+ indent,
+ compact,
+ ignore_errors,
+ dst_crs,
+ use_rs,
+ bbox,
+ cut_at_antimeridian,
+ layer,
+):
"""
Concatenate and print the features of input datasets as a sequence of
GeoJSON features.
@@ -76,7 +97,7 @@ def cat(ctx, files, precision, indent, compact, ignore_errors, dst_crs,
if dst_crs or precision >= 0:
g = transform_geom(
src.crs, dst_crs, feat['geometry'],
- antimeridian_cutting=True,
+ antimeridian_cutting=cut_at_antimeridian,
precision=precision)
feat['geometry'] = g
feat['bbox'] = fiona.bounds(g)
=====================================
fiona/ogrext.pyx
=====================================
@@ -1797,6 +1797,8 @@ cdef class MemoryFileBase:
int
"""
+ if not self.getbuffer():
+ return 0
return self.getbuffer().size
def getbuffer(self):
@@ -1809,10 +1811,10 @@ cdef class MemoryFileBase:
buffer = VSIGetMemFileBuffer(name_b, &buffer_len, 0)
if buffer == NULL or buffer_len == 0:
- buff_view = memoryview(b"")
+ return None
else:
buff_view = <unsigned char [:buffer_len]>buffer
- return buff_view
+ return buff_view
def close(self):
"""Close and tear down VSI file and directory."""
=====================================
tests/test_fio_cat.py
=====================================
@@ -84,3 +84,13 @@ def test_vfs(path_coutwildrnp_zip):
'cat', 'zip://{}'.format(path_coutwildrnp_zip)])
assert result.exit_code == 0
assert result.output.count('"Feature"') == 67
+
+
+def test_dst_crs_epsg3857(path_coutwildrnp_shp):
+ """Confirm fix of issue #952"""
+ runner = CliRunner()
+ result = runner.invoke(
+ main_group, ["cat", "--dst-crs", "EPSG:3857", path_coutwildrnp_shp]
+ )
+ assert result.exit_code == 0
+ assert result.output.count('"Feature"') == 67
=====================================
tests/test_memoryfile.py
=====================================
@@ -107,6 +107,14 @@ def test_memoryfile_write_extension(profile_first_coutwildrnp_shp):
assert memfile.name.endswith(".shp")
+def test_memoryfile_open_file_or_bytes_read(path_coutwildrnp_json):
+ """Test MemoryFile.open when file_or_bytes has a read attribute """
+ with open(path_coutwildrnp_json, 'rb') as f:
+ with MemoryFile(f) as memfile:
+ with memfile.open() as collection:
+ assert len(collection) == 67
+
+
def test_memoryfile_bytesio(data_coutwildrnp_json):
"""GeoJSON file stored in BytesIO can be read"""
with fiona.open(BytesIO(data_coutwildrnp_json)) as collection:
@@ -120,6 +128,22 @@ def test_memoryfile_fileobj(path_coutwildrnp_json):
assert len(collection) == 67
+def test_memoryfile_len(data_coutwildrnp_json):
+ """Test MemoryFile.__len__ """
+ with MemoryFile() as memfile:
+ assert len(memfile) == 0
+ memfile.write(data_coutwildrnp_json)
+ assert len(memfile) == len(data_coutwildrnp_json)
+
+
+def test_memoryfile_tell(data_coutwildrnp_json):
+ """Test MemoryFile.tell() """
+ with MemoryFile() as memfile:
+ assert memfile.tell() == 0
+ memfile.write(data_coutwildrnp_json)
+ assert memfile.tell() == len(data_coutwildrnp_json)
+
+
def test_write_bytesio(profile_first_coutwildrnp_shp):
"""GeoJSON can be written to BytesIO"""
profile, first = profile_first_coutwildrnp_shp
View it on GitLab: https://salsa.debian.org/debian-gis-team/fiona/-/commit/253d7e60239157d0c0a69871b7ac1abda285d5d0
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/fiona/-/commit/253d7e60239157d0c0a69871b7ac1abda285d5d0
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/20200910/01bd9657/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list