One function
is_valid in jazzband/geojson
The author described this change as “fix for issue #79”. It counts as a record because the check below fails on the code as it stood at 8d259b5de and passes on c9fedf839, with nothing else changed between the two runs.
Projectjazzband/geojson
Fix saved2017-04-24
Sharing licenceBSD-3-Clause · LICENSE.rst
Change size+2 −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 official site http://geojson.org/geojson-spec.html Args: obj(geoJSON object): check validation Returns: dict of two parameters '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
| 23 | 23 | return output('this is not GeoJSON object') | |
| 24 | 24 | ||
| 25 | 25 | if isinstance(obj, geojson.Point): | |
| 26 | - | if len(obj['coordinates']) != 2: | |
| 26 | + | if len(obj['coordinates']) not in (2, 3): | |
| 27 | 27 | return output('the "coordinates" member must be a single position') | |
| 28 | 28 | ||
| 29 | 29 | if isinstance(obj, geojson.MultiPoint): | |
| 30 | - | if checkListOfObjects(obj['coordinates'], lambda x: len(x) == 2): | |
| 30 | + | if checkListOfObjects(obj['coordinates'], lambda x: len(x) in (2, 3)): | |
| 31 | 31 | return output( | |
| 32 | 32 | 'the "coordinates" member must be an array of positions' | |
| 33 | 33 | ) |
The check that tells the two apart
fail→pass·tests/test_validation.py::TestValidationGeometry::test_valid_geometry_with_elevation
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 it8d259b5deb762e2b15f206ff84658771b019bd6b
Broken version dated2017-02-11
Modulegeojson.validation
Units changedis_valid
Fingerprintfe5ac8371da9c1c9
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
- 2015-10-12is_valid