Hello community, here is the log from the commit of package python-geojson for openSUSE:Factory checked in at 2019-03-01 16:49:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-geojson (Old) and /work/SRC/openSUSE:Factory/.python-geojson.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-geojson" Fri Mar 1 16:49:57 2019 rev:2 rq:680457 version:2.4.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-geojson/python-geojson.changes 2018-07-31 16:00:24.927649900 +0200 +++ /work/SRC/openSUSE:Factory/.python-geojson.new.28833/python-geojson.changes 2019-03-01 16:50:00.137740742 +0100 @@ -1,0 +2,6 @@ +Fri Mar 1 10:59:48 UTC 2019 - Tomáš Chvátal <[email protected]> + +- Update to 2.4.1: + * Allow FeatureCollections to be passed to coords + +------------------------------------------------------------------- Old: ---- 2.4.0.tar.gz New: ---- 2.4.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-geojson.spec ++++++ --- /var/tmp/diff_new_pack.vCPaoV/_old 2019-03-01 16:50:02.333739914 +0100 +++ /var/tmp/diff_new_pack.vCPaoV/_new 2019-03-01 16:50:02.333739914 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-geojson # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,13 +12,13 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-geojson -Version: 2.4.0 +Version: 2.4.1 Release: 0 Summary: Python bindings and utilities for GeoJSON License: BSD-3-Clause ++++++ 2.4.0.tar.gz -> 2.4.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-geojson-2.4.0/CHANGELOG.rst new/python-geojson-2.4.1/CHANGELOG.rst --- old/python-geojson-2.4.0/CHANGELOG.rst 2018-05-22 03:18:45.000000000 +0200 +++ new/python-geojson-2.4.1/CHANGELOG.rst 2018-10-18 05:29:47.000000000 +0200 @@ -1,6 +1,13 @@ Changes ======= +2.4.1 (2018-10-17) +------------------ + +- Allow ``FeatureCollections`` to be passed to ``coords`` + + - https://github.com/frewsxcv/python-geojson/pull/117 + 2.4.0 (2018-05-21) ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-geojson-2.4.0/README.rst new/python-geojson-2.4.1/README.rst --- old/python-geojson-2.4.0/README.rst 2018-05-22 03:18:45.000000000 +0200 +++ new/python-geojson-2.4.1/README.rst 2018-10-18 05:29:47.000000000 +0200 @@ -224,7 +224,7 @@ GeoJSON encoding/decoding ------------------------- -All of the GeoJSON Objects implemented in this library can be encoded and decoded into raw GeoJSON with the ``geojson.dump``, ``geojson.dumps``, ``geojson.load``, and ``geojson.loads`` functions. +All of the GeoJSON Objects implemented in this library can be encoded and decoded into raw GeoJSON with the ``geojson.dump``, ``geojson.dumps``, ``geojson.load``, and ``geojson.loads`` functions. Note that each of these functions is a wrapper around the core `json` function with the same name, and will pass through any additional arguments. This allows you to control the JSON formatting or parsing behavior with the underlying core `json` functions. .. code:: python diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-geojson-2.4.0/geojson/_version.py new/python-geojson-2.4.1/geojson/_version.py --- old/python-geojson-2.4.0/geojson/_version.py 2018-05-22 03:18:45.000000000 +0200 +++ new/python-geojson-2.4.1/geojson/_version.py 2018-10-18 05:29:47.000000000 +0200 @@ -1,2 +1,2 @@ -__version__ = "2.4.0" +__version__ = "2.4.1" __version_info__ = tuple(map(int, __version__.split("."))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-geojson-2.4.0/geojson/geometry.py new/python-geojson-2.4.1/geojson/geometry.py --- old/python-geojson-2.4.0/geojson/geometry.py 2018-05-22 03:18:45.000000000 +0200 +++ new/python-geojson-2.4.1/geojson/geometry.py 2018-10-18 05:29:47.000000000 +0200 @@ -21,7 +21,7 @@ Initialises a Geometry object. :param coordinates: Coordinates of the Geometry object. - :type coordinates: tuple + :type coordinates: tuple or list of tuple :param crs: CRS :type crs: CRS object """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-geojson-2.4.0/geojson/utils.py new/python-geojson-2.4.1/geojson/utils.py --- old/python-geojson-2.4.0/geojson/utils.py 2018-05-22 03:18:45.000000000 +0200 +++ new/python-geojson-2.4.1/geojson/utils.py 2018-10-18 05:29:47.000000000 +0200 @@ -10,19 +10,26 @@ :return: A generator with coordinate tuples from the geometry or feature. :rtype: generator """ - - if isinstance(obj, (tuple, list)): - coordinates = obj - elif 'geometry' in obj: - coordinates = obj['geometry']['coordinates'] + # Handle recursive case first + if 'features' in obj: + for f in obj['features']: + # For Python 2 compatibility + # See https://www.reddit.com/r/learnpython/comments/4rc15s/yield_from_and_python_27/ # noqa: E501 + for c in coords(f): + yield c else: - coordinates = obj.get('coordinates', obj) - for e in coordinates: - if isinstance(e, (float, int)): - yield tuple(coordinates) - break - for f in coords(e): - yield f + if isinstance(obj, (tuple, list)): + coordinates = obj + elif 'geometry' in obj: + coordinates = obj['geometry']['coordinates'] + else: + coordinates = obj.get('coordinates', obj) + for e in coordinates: + if isinstance(e, (float, int)): + yield tuple(coordinates) + break + for f in coords(e): + yield f def map_coords(func, obj): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-geojson-2.4.0/tests/test_coords.py new/python-geojson-2.4.1/tests/test_coords.py --- old/python-geojson-2.4.0/tests/test_coords.py 2018-05-22 03:18:45.000000000 +0200 +++ new/python-geojson-2.4.1/tests/test_coords.py 2018-10-18 05:29:47.000000000 +0200 @@ -27,6 +27,14 @@ self.assertEqual(pairs[0], (3.78, 9.28)) self.assertEqual(pairs[-1], (23.18, -34.29)) + def test_featurecollection(self): + p1 = geojson.Feature(geometry=geojson.Point((-115.11, 37.11))) + p2 = geojson.Feature(geometry=geojson.Point((-115.22, 37.22))) + itr = coords(geojson.FeatureCollection([p1, p2])) + pairs = list(itr) + self.assertEqual(pairs[0], (-115.11, 37.11)) + self.assertEqual(pairs[1], (-115.22, 37.22)) + def test_map_point(self): result = map_coords(lambda x: x, geojson.Point((-115.81, 37.24))) self.assertEqual(result['type'], 'Point')
