One function
is_valid in jazzband/geojson
The author described this change as “Fix MultiPolygon validation”. It counts as a record because the check below fails on the code as it stood at cb0d7f9d9 and passes on c788b501c, with nothing else changed between the two runs.
Projectjazzband/geojson
Fix saved2015-10-12
Sharing licenceBSD-3-Clause · LICENSE.rst
Change size+1 −2
What the code was meant to do, written into the code itself as a docstring
IsValid provides validation for GeoJSON objects All of error messages obtained from the offical site http://geojson.org/geojson-spec.html Args: obj(geoJSON object): check validation Returns: dict of two paremeters 'valid' and 'message'. In the case if geoJSON object is valid, returns {valid: 'yes', message: ''} If json objects is not valid, returns {valid: 'no', message:'explanation, why this object is not valid'} Example: >> point = Point((10,20), (30,40)) >> IsValid(point) >> {valid: 'yes', message: ''}
The change
| 55 | 55 | 'must be equivalent') | |
| 56 | 56 | ||
| 57 | 57 | if isinstance(obj, geojson.MultiPolygon): | |
| 58 | - | if checkListOfObjects(obj['coordinates'], | |
| 59 | - | lambda x: len(x) >= 4 and x[0] == x[-1]): | |
| 58 | + | if checkListOfObjects(obj['coordinates'], lambda x: is_polygon(x)): | |
| 60 | 59 | return output('the "coordinates" member must be an array' | |
| 61 | 60 | 'of Polygon coordinate arrays') | |
| 62 | 61 |
The check that tells the two apart
fail→pass·tests/test_validation.py::TestValidationMultiPolygon::test_valid_multipolygon
Check file tests/test_validation.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itcb0d7f9d9a89c6d41ad7457e083aaa6abdf9f966
Broken version dated2015-08-11
Modulegeojson.validation
Units changedis_valid
Fingerprint254d678438894154
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in jazzband/geojson
- 2026-05-18FeatureCollection
- 2017-04-24is_valid