geojson-diff 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/CHANGELOG.md +23 -2
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/CITATION.cff +5 -4
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/PKG-INFO +46 -17
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/README.md +34 -8
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/pyproject.toml +18 -15
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/__init__.py +1 -1
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/cli.py +21 -3
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/core.py +6 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/render/html.py +1 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/render/markdown.py +1 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/tolerance.py +4 -3
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff.egg-info/PKG-INFO +46 -17
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/tests/test_cli_git.py +14 -1
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/tests/test_diff.py +17 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/tests/test_render.py +11 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/tests/test_tolerance_io.py +3 -1
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/LICENSE +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/MANIFEST.in +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/examples/github-actions/geojson-diff.yml +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/examples/parcels_v1.geojson +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/examples/parcels_v2.geojson +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/setup.cfg +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/__main__.py +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/_shapely.py +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/geometry.py +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/git.py +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/io.py +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/matching.py +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/properties.py +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/py.typed +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/render/__init__.py +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/render/layer.py +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/render/machine.py +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff/render/text.py +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff.egg-info/SOURCES.txt +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff.egg-info/dependency_links.txt +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff.egg-info/entry_points.txt +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff.egg-info/requires.txt +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/src/geojson_diff.egg-info/top_level.txt +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/tests/conftest.py +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/tests/test_geometry_properties.py +0 -0
- {geojson_diff-0.1.0 → geojson_diff-0.1.2}/tests/test_shapely_examples.py +0 -0
|
@@ -6,6 +6,27 @@ project uses [Semantic Versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.1.2] - 2026-11-15
|
|
10
|
+
### Fixed
|
|
11
|
+
- `precision` outside 0-15 is rejected (`DiffOptions`, `--precision`): a negative value
|
|
12
|
+
rounded geometry hashes to tens of degrees and matched unrelated features.
|
|
13
|
+
- `min_score` outside [0, 1] (or NaN) is rejected instead of silently dropping every
|
|
14
|
+
spatial match.
|
|
15
|
+
- A negative `max_rows` / `--max-rows` no longer slices rows from the end of the
|
|
16
|
+
Markdown and HTML tables and prints a wrong "more changes" count.
|
|
17
|
+
- Tolerances written with a trailing decimal point (`"1.m"`) are accepted; infinite
|
|
18
|
+
tolerances are rejected.
|
|
19
|
+
### Changed
|
|
20
|
+
- Project links, citation metadata and CI moved to GitLab (https://gitlab.com/geophilo1/geojson_diff_sdk);
|
|
21
|
+
GitHub workflows removed, GitLab CI pipeline added (Python 3.9, 3.11, 3.13; tagged releases to PyPI).
|
|
22
|
+
- README: GitLab pipeline and downloads badges, absolute links that work on PyPI, related packages.
|
|
23
|
+
- PyPI metadata: refined description and keywords, Education audience classifier,
|
|
24
|
+
SDK dashboard / DOI links.
|
|
25
|
+
|
|
26
|
+
## [0.1.1] - 2026-11-09
|
|
27
|
+
### Changed
|
|
28
|
+
- Release archived on Zenodo, which mints the citable DOI; no code changes.
|
|
29
|
+
|
|
9
30
|
## [0.1.0] - 2026-11-08
|
|
10
31
|
### Added
|
|
11
32
|
- **Diff engine** (`geojson_diff.diff`): compares two GeoJSON FeatureCollections,
|
|
@@ -34,5 +55,5 @@ project uses [Semantic Versioning](https://semver.org/).
|
|
|
34
55
|
strategy the new file is streamed against an index of the old one.
|
|
35
56
|
- Optional `shapely` extra for topological equality and symmetric-difference area.
|
|
36
57
|
|
|
37
|
-
[Unreleased]: https://
|
|
38
|
-
[0.1.0]: https://
|
|
58
|
+
[Unreleased]: https://gitlab.com/geophilo1/geojson_diff_sdk/-/compare/v0.1.0...HEAD
|
|
59
|
+
[0.1.0]: https://gitlab.com/geophilo1/geojson_diff_sdk/-/tags/v0.1.0
|
|
@@ -3,13 +3,14 @@ message: "If you use this software, please cite it as below."
|
|
|
3
3
|
authors:
|
|
4
4
|
- family-names: "Eminoğlu"
|
|
5
5
|
given-names: "Yusuf"
|
|
6
|
-
email: "
|
|
6
|
+
email: "geospacephilo@gmail.com"
|
|
7
7
|
orcid: "https://orcid.org/0009-0005-6000-2934"
|
|
8
8
|
title: "geojson-diff"
|
|
9
|
-
version: "0.1.
|
|
10
|
-
date-released: "2026-11-
|
|
9
|
+
version: "0.1.2"
|
|
10
|
+
date-released: "2026-11-15"
|
|
11
|
+
doi: "10.5281/zenodo.24063377"
|
|
11
12
|
license: "MIT"
|
|
12
|
-
repository-code: "https://
|
|
13
|
+
repository-code: "https://gitlab.com/geophilo1/geojson_diff_sdk"
|
|
13
14
|
url: "https://pypi.org/project/geojson-diff/"
|
|
14
15
|
abstract: "Feature-level diffs of GeoJSON datasets for code review, pull requests and data pipelines, with tolerance-aware geometry comparison, typed property diffs, text/JSON/Markdown/GeoJSON/HTML reports, a git diff driver and CI exit codes."
|
|
15
16
|
keywords:
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: geojson-diff
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary:
|
|
5
|
-
Author-email: Yusuf Eminoğlu <
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Compare two GeoJSON files feature by feature: added, removed, modified and moved features with tolerances in metres, text/JSON/Markdown/HTML map reports, a git diff driver and CI exit codes.
|
|
5
|
+
Author-email: Yusuf Eminoğlu <geospacephilo@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
7
|
-
Project-URL: Homepage, https://
|
|
8
|
-
Project-URL: Repository, https://
|
|
9
|
-
Project-URL:
|
|
10
|
-
Project-URL:
|
|
11
|
-
Project-URL: Changelog, https://
|
|
12
|
-
|
|
7
|
+
Project-URL: Homepage, https://gitlab.com/geophilo1/geojson_diff_sdk
|
|
8
|
+
Project-URL: Repository, https://gitlab.com/geophilo1/geojson_diff_sdk
|
|
9
|
+
Project-URL: Documentation, https://gitlab.com/geophilo1/geojson_diff_sdk#readme
|
|
10
|
+
Project-URL: Issues, https://gitlab.com/geophilo1/geojson_diff_sdk/-/work_items
|
|
11
|
+
Project-URL: Changelog, https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/CHANGELOG.md
|
|
12
|
+
Project-URL: SDK dashboard, https://geophilo.com/sdk-dashboard/
|
|
13
|
+
Project-URL: DOI, https://doi.org/10.5281/zenodo.24063377
|
|
14
|
+
Keywords: geojson,geojson-diff,diff,compare-geojson,change-detection,git-diff,code-review,pull-request,data-pipeline,data-quality,hausdorff,geojsonseq,leaflet,gis
|
|
13
15
|
Classifier: Development Status :: 4 - Beta
|
|
14
16
|
Classifier: Programming Language :: Python :: 3
|
|
15
17
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -25,6 +27,7 @@ Classifier: Topic :: Software Development :: Version Control :: Git
|
|
|
25
27
|
Classifier: Topic :: Utilities
|
|
26
28
|
Classifier: Intended Audience :: Science/Research
|
|
27
29
|
Classifier: Intended Audience :: Developers
|
|
30
|
+
Classifier: Intended Audience :: Education
|
|
28
31
|
Classifier: Typing :: Typed
|
|
29
32
|
Requires-Python: >=3.9
|
|
30
33
|
Description-Content-Type: text/markdown
|
|
@@ -38,12 +41,18 @@ Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
|
38
41
|
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
39
42
|
Dynamic: license-file
|
|
40
43
|
|
|
44
|
+
<p align="center">
|
|
45
|
+
<a href="https://geophilo.com/sdk-dashboard/"><img src="https://geophilo.com/assets/sdk_icons/geojson_diff_sdk.svg" width="120" height="120" alt="geojson-diff icon"></a>
|
|
46
|
+
</p>
|
|
47
|
+
|
|
41
48
|
# geojson-diff
|
|
42
49
|
|
|
43
|
-
[](LICENSE)
|
|
50
|
+
[](https://pypi.org/project/geojson-diff/)
|
|
51
|
+
[](https://pypi.org/project/geojson-diff/)
|
|
52
|
+
[](https://gitlab.com/geophilo1/geojson_diff_sdk/-/pipelines)
|
|
53
|
+
[](https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/LICENSE)
|
|
54
|
+
[](https://doi.org/10.5281/zenodo.24063377)
|
|
55
|
+
[](https://pepy.tech/project/geojson-diff)
|
|
47
56
|
|
|
48
57
|
**Feature-level diffs of GeoJSON datasets** for GIS and data teams that review
|
|
49
58
|
changes in git, pull requests and data pipelines.
|
|
@@ -84,7 +93,7 @@ geojson-diff old.geojson new.geojson [--key id] [--tolerance 0.5m] \
|
|
|
84
93
|
[--format text|json|md|geojson|html] [-o out]
|
|
85
94
|
```
|
|
86
95
|
|
|
87
|
-
Using the two files in [`examples/`](examples):
|
|
96
|
+
Using the two files in [`examples/`](https://gitlab.com/geophilo1/geojson_diff_sdk/-/tree/main/examples):
|
|
88
97
|
|
|
89
98
|
```console
|
|
90
99
|
$ geojson-diff parcels_v1.geojson parcels_v2.geojson --tolerance 0.5m
|
|
@@ -358,7 +367,7 @@ optional `:N` allowance (exit 1 when the count exceeds N; default 0).
|
|
|
358
367
|
|
|
359
368
|
### GitHub Actions: post the summary on pull requests
|
|
360
369
|
|
|
361
|
-
[`examples/github-actions/geojson-diff.yml`](examples/github-actions/geojson-diff.yml)
|
|
370
|
+
[`examples/github-actions/geojson-diff.yml`](https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/examples/github-actions/geojson-diff.yml)
|
|
362
371
|
diffs every changed `*.geojson` file between the pull-request base and head, posts a
|
|
363
372
|
single Markdown comment (updated on later pushes), copies it to the job summary and
|
|
364
373
|
fails the check when features were removed. The core of it:
|
|
@@ -464,15 +473,35 @@ With `pip install "geojson-diff[shapely]"` and `--shapely` (`use_shapely=True`):
|
|
|
464
473
|
## Development
|
|
465
474
|
|
|
466
475
|
```bash
|
|
476
|
+
git clone https://gitlab.com/geophilo1/geojson_diff_sdk.git
|
|
477
|
+
cd geojson_diff_sdk
|
|
467
478
|
python -m pip install -e ".[dev,shapely]"
|
|
468
479
|
python -m pytest --cov=geojson_diff
|
|
469
480
|
python -m ruff check . && python -m ruff format --check src tests
|
|
470
481
|
python -m mypy src
|
|
471
482
|
```
|
|
472
483
|
|
|
484
|
+
## Related Geophilo SDKs
|
|
485
|
+
|
|
486
|
+
- [geofix](https://pypi.org/project/geofix/): validate and repair GeoJSON (RFC 7946) for local runs, pre-commit and CI.
|
|
487
|
+
- [geocsv](https://pypi.org/project/geocsv/): convert CSV and spreadsheet exports of places into validated GeoJSON, GeoPackage, KML or GPX.
|
|
488
|
+
- [poi-dedupe](https://pypi.org/project/poi-dedupe/): deduplicate and conflate points of interest with spatial blocking and fuzzy matching.
|
|
489
|
+
- [gpkglite](https://pypi.org/project/gpkglite/): read, write and validate OGC GeoPackage files in pure Python.
|
|
490
|
+
|
|
473
491
|
## License and citation
|
|
474
492
|
|
|
475
|
-
|
|
476
|
-
|
|
493
|
+
```bibtex
|
|
494
|
+
@software{eminoglu_geojson_diff,
|
|
495
|
+
author = {Eminoğlu, Yusuf},
|
|
496
|
+
title = {geojson-diff},
|
|
497
|
+
year = {2026},
|
|
498
|
+
version = {0.1.2},
|
|
499
|
+
doi = {10.5281/zenodo.24063377},
|
|
500
|
+
url = {https://doi.org/10.5281/zenodo.24063377}
|
|
501
|
+
}
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
MIT License - see [LICENSE](https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/LICENSE). If you use `geojson-diff` in research, please
|
|
505
|
+
cite it using [CITATION.cff](https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/CITATION.cff).
|
|
477
506
|
|
|
478
507
|
Author: Yusuf Eminoğlu
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://geophilo.com/sdk-dashboard/"><img src="https://geophilo.com/assets/sdk_icons/geojson_diff_sdk.svg" width="120" height="120" alt="geojson-diff icon"></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# geojson-diff
|
|
2
6
|
|
|
3
|
-
[](LICENSE)
|
|
7
|
+
[](https://pypi.org/project/geojson-diff/)
|
|
8
|
+
[](https://pypi.org/project/geojson-diff/)
|
|
9
|
+
[](https://gitlab.com/geophilo1/geojson_diff_sdk/-/pipelines)
|
|
10
|
+
[](https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/LICENSE)
|
|
11
|
+
[](https://doi.org/10.5281/zenodo.24063377)
|
|
12
|
+
[](https://pepy.tech/project/geojson-diff)
|
|
7
13
|
|
|
8
14
|
**Feature-level diffs of GeoJSON datasets** for GIS and data teams that review
|
|
9
15
|
changes in git, pull requests and data pipelines.
|
|
@@ -44,7 +50,7 @@ geojson-diff old.geojson new.geojson [--key id] [--tolerance 0.5m] \
|
|
|
44
50
|
[--format text|json|md|geojson|html] [-o out]
|
|
45
51
|
```
|
|
46
52
|
|
|
47
|
-
Using the two files in [`examples/`](examples):
|
|
53
|
+
Using the two files in [`examples/`](https://gitlab.com/geophilo1/geojson_diff_sdk/-/tree/main/examples):
|
|
48
54
|
|
|
49
55
|
```console
|
|
50
56
|
$ geojson-diff parcels_v1.geojson parcels_v2.geojson --tolerance 0.5m
|
|
@@ -318,7 +324,7 @@ optional `:N` allowance (exit 1 when the count exceeds N; default 0).
|
|
|
318
324
|
|
|
319
325
|
### GitHub Actions: post the summary on pull requests
|
|
320
326
|
|
|
321
|
-
[`examples/github-actions/geojson-diff.yml`](examples/github-actions/geojson-diff.yml)
|
|
327
|
+
[`examples/github-actions/geojson-diff.yml`](https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/examples/github-actions/geojson-diff.yml)
|
|
322
328
|
diffs every changed `*.geojson` file between the pull-request base and head, posts a
|
|
323
329
|
single Markdown comment (updated on later pushes), copies it to the job summary and
|
|
324
330
|
fails the check when features were removed. The core of it:
|
|
@@ -424,15 +430,35 @@ With `pip install "geojson-diff[shapely]"` and `--shapely` (`use_shapely=True`):
|
|
|
424
430
|
## Development
|
|
425
431
|
|
|
426
432
|
```bash
|
|
433
|
+
git clone https://gitlab.com/geophilo1/geojson_diff_sdk.git
|
|
434
|
+
cd geojson_diff_sdk
|
|
427
435
|
python -m pip install -e ".[dev,shapely]"
|
|
428
436
|
python -m pytest --cov=geojson_diff
|
|
429
437
|
python -m ruff check . && python -m ruff format --check src tests
|
|
430
438
|
python -m mypy src
|
|
431
439
|
```
|
|
432
440
|
|
|
441
|
+
## Related Geophilo SDKs
|
|
442
|
+
|
|
443
|
+
- [geofix](https://pypi.org/project/geofix/): validate and repair GeoJSON (RFC 7946) for local runs, pre-commit and CI.
|
|
444
|
+
- [geocsv](https://pypi.org/project/geocsv/): convert CSV and spreadsheet exports of places into validated GeoJSON, GeoPackage, KML or GPX.
|
|
445
|
+
- [poi-dedupe](https://pypi.org/project/poi-dedupe/): deduplicate and conflate points of interest with spatial blocking and fuzzy matching.
|
|
446
|
+
- [gpkglite](https://pypi.org/project/gpkglite/): read, write and validate OGC GeoPackage files in pure Python.
|
|
447
|
+
|
|
433
448
|
## License and citation
|
|
434
449
|
|
|
435
|
-
|
|
436
|
-
|
|
450
|
+
```bibtex
|
|
451
|
+
@software{eminoglu_geojson_diff,
|
|
452
|
+
author = {Eminoğlu, Yusuf},
|
|
453
|
+
title = {geojson-diff},
|
|
454
|
+
year = {2026},
|
|
455
|
+
version = {0.1.2},
|
|
456
|
+
doi = {10.5281/zenodo.24063377},
|
|
457
|
+
url = {https://doi.org/10.5281/zenodo.24063377}
|
|
458
|
+
}
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
MIT License - see [LICENSE](https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/LICENSE). If you use `geojson-diff` in research, please
|
|
462
|
+
cite it using [CITATION.cff](https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/CITATION.cff).
|
|
437
463
|
|
|
438
464
|
Author: Yusuf Eminoğlu
|
|
@@ -4,26 +4,26 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "geojson-diff"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.2"
|
|
8
8
|
authors = [
|
|
9
|
-
{ name = "Yusuf Eminoğlu", email = "
|
|
9
|
+
{ name = "Yusuf Eminoğlu", email = "geospacephilo@gmail.com" }
|
|
10
10
|
]
|
|
11
|
-
description = "
|
|
11
|
+
description = "Compare two GeoJSON files feature by feature: added, removed, modified and moved features with tolerances in metres, text/JSON/Markdown/HTML map reports, a git diff driver and CI exit codes."
|
|
12
12
|
keywords = [
|
|
13
13
|
"geojson",
|
|
14
|
+
"geojson-diff",
|
|
14
15
|
"diff",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"git",
|
|
16
|
+
"compare-geojson",
|
|
17
|
+
"change-detection",
|
|
18
|
+
"git-diff",
|
|
18
19
|
"code-review",
|
|
19
20
|
"pull-request",
|
|
20
21
|
"data-pipeline",
|
|
21
|
-
"
|
|
22
|
-
"geojsonseq",
|
|
22
|
+
"data-quality",
|
|
23
23
|
"hausdorff",
|
|
24
|
+
"geojsonseq",
|
|
24
25
|
"leaflet",
|
|
25
|
-
"
|
|
26
|
-
"data-quality",
|
|
26
|
+
"gis",
|
|
27
27
|
]
|
|
28
28
|
readme = "README.md"
|
|
29
29
|
license = "MIT"
|
|
@@ -45,6 +45,7 @@ classifiers = [
|
|
|
45
45
|
"Topic :: Utilities",
|
|
46
46
|
"Intended Audience :: Science/Research",
|
|
47
47
|
"Intended Audience :: Developers",
|
|
48
|
+
"Intended Audience :: Education",
|
|
48
49
|
"Typing :: Typed",
|
|
49
50
|
]
|
|
50
51
|
dependencies = []
|
|
@@ -65,11 +66,13 @@ geojson-diff = "geojson_diff.cli:main"
|
|
|
65
66
|
git-geojson-diff = "geojson_diff.cli:git_main"
|
|
66
67
|
|
|
67
68
|
[project.urls]
|
|
68
|
-
Homepage = "https://
|
|
69
|
-
Repository = "https://
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
Changelog = "https://
|
|
69
|
+
Homepage = "https://gitlab.com/geophilo1/geojson_diff_sdk"
|
|
70
|
+
Repository = "https://gitlab.com/geophilo1/geojson_diff_sdk"
|
|
71
|
+
Documentation = "https://gitlab.com/geophilo1/geojson_diff_sdk#readme"
|
|
72
|
+
Issues = "https://gitlab.com/geophilo1/geojson_diff_sdk/-/work_items"
|
|
73
|
+
Changelog = "https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/CHANGELOG.md"
|
|
74
|
+
"SDK dashboard" = "https://geophilo.com/sdk-dashboard/"
|
|
75
|
+
DOI = "https://doi.org/10.5281/zenodo.24063377"
|
|
73
76
|
|
|
74
77
|
[tool.setuptools]
|
|
75
78
|
package-dir = {"" = "src"}
|
|
@@ -6,7 +6,7 @@ import argparse
|
|
|
6
6
|
import os
|
|
7
7
|
import sys
|
|
8
8
|
from collections.abc import Sequence
|
|
9
|
-
from typing import TextIO
|
|
9
|
+
from typing import Callable, TextIO
|
|
10
10
|
|
|
11
11
|
from . import __version__
|
|
12
12
|
from .core import DiffOptions, DiffResult, diff
|
|
@@ -31,6 +31,22 @@ _EXTENSIONS = {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
|
|
34
|
+
def _int_in_range(low: int, high: int | None = None) -> Callable[[str], int]:
|
|
35
|
+
"""argparse type: an integer between ``low`` and ``high`` (inclusive)."""
|
|
36
|
+
|
|
37
|
+
def convert(value: str) -> int:
|
|
38
|
+
try:
|
|
39
|
+
n = int(value)
|
|
40
|
+
except ValueError:
|
|
41
|
+
raise argparse.ArgumentTypeError(f"invalid int value: {value!r}") from None
|
|
42
|
+
if n < low or (high is not None and n > high):
|
|
43
|
+
limit = f"between {low} and {high}" if high is not None else f"{low} or more"
|
|
44
|
+
raise argparse.ArgumentTypeError(f"must be {limit}, got {n}")
|
|
45
|
+
return n
|
|
46
|
+
|
|
47
|
+
return convert
|
|
48
|
+
|
|
49
|
+
|
|
34
50
|
def parse_fail_on(spec: str | None) -> dict[str, int]:
|
|
35
51
|
"""Parse ``removed,modified`` or ``removed:10,moved:0`` into allowed counts.
|
|
36
52
|
|
|
@@ -113,7 +129,7 @@ def _add_diff_options(parser: argparse.ArgumentParser) -> None:
|
|
|
113
129
|
)
|
|
114
130
|
m.add_argument(
|
|
115
131
|
"--precision",
|
|
116
|
-
type=
|
|
132
|
+
type=_int_in_range(0, 15),
|
|
117
133
|
default=7,
|
|
118
134
|
metavar="N",
|
|
119
135
|
help="decimals kept when hashing geometries (default 7)",
|
|
@@ -160,7 +176,9 @@ def _add_diff_options(parser: argparse.ArgumentParser) -> None:
|
|
|
160
176
|
help="colour text output (default auto: when stdout is a terminal)",
|
|
161
177
|
)
|
|
162
178
|
o.add_argument("--show-unchanged", action="store_true", help="list unchanged features too")
|
|
163
|
-
o.add_argument(
|
|
179
|
+
o.add_argument(
|
|
180
|
+
"--max-rows", type=_int_in_range(0), default=100, metavar="N", help="rows in md tables"
|
|
181
|
+
)
|
|
164
182
|
o.add_argument("--title", default="", help="title for md/html reports")
|
|
165
183
|
o.add_argument(
|
|
166
184
|
"--md-map",
|
|
@@ -94,6 +94,12 @@ class DiffOptions:
|
|
|
94
94
|
)
|
|
95
95
|
if "key" in self.match and not self.keys:
|
|
96
96
|
raise ValueError("the 'key' strategy needs at least one property name (keys=...)")
|
|
97
|
+
if isinstance(self.precision, bool) or not isinstance(self.precision, int):
|
|
98
|
+
raise ValueError(f"precision must be an integer, got {self.precision!r}")
|
|
99
|
+
if not 0 <= self.precision <= 15:
|
|
100
|
+
raise ValueError(f"precision must be between 0 and 15, got {self.precision}")
|
|
101
|
+
if not 0.0 <= self.min_score <= 1.0: # also rejects NaN
|
|
102
|
+
raise ValueError(f"min_score must be between 0 and 1, got {self.min_score}")
|
|
97
103
|
|
|
98
104
|
def strategies(self) -> list[str]:
|
|
99
105
|
"""The effective, de-duplicated strategy chain."""
|
|
@@ -61,6 +61,7 @@ def render_markdown(
|
|
|
61
61
|
which GitHub renders as an interactive map, when it fits in ``map_limit``
|
|
62
62
|
characters.
|
|
63
63
|
"""
|
|
64
|
+
max_rows = max(0, max_rows)
|
|
64
65
|
c = result.counts
|
|
65
66
|
heading = title or f"GeoJSON diff: {result.old_name} → {result.new_name}"
|
|
66
67
|
lines: list[str] = [f"### {escape_markdown(heading)}", ""]
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import math
|
|
5
6
|
import re
|
|
6
7
|
from dataclasses import dataclass
|
|
7
8
|
from typing import Union
|
|
@@ -25,7 +26,7 @@ _UNIT_FACTORS = {
|
|
|
25
26
|
"": ("deg", 1.0),
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
_PATTERN = re.compile(r"^\s*([0-9]
|
|
29
|
+
_PATTERN = re.compile(r"^\s*((?:[0-9]+\.?[0-9]*|\.[0-9]+)(?:[eE][-+]?[0-9]+)?)\s*([a-zA-Z°]*)\s*$")
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
@dataclass(frozen=True)
|
|
@@ -43,8 +44,8 @@ class Tolerance:
|
|
|
43
44
|
def __post_init__(self) -> None:
|
|
44
45
|
if self.unit not in ("m", "deg"):
|
|
45
46
|
raise ValueError(f"unknown tolerance unit {self.unit!r}; use 'm' or 'deg'")
|
|
46
|
-
if not self.value >= 0.0: # also rejects NaN
|
|
47
|
-
raise ValueError("tolerance must be a non-negative number")
|
|
47
|
+
if not (self.value >= 0.0 and math.isfinite(self.value)): # also rejects NaN
|
|
48
|
+
raise ValueError("tolerance must be a non-negative finite number")
|
|
48
49
|
|
|
49
50
|
@property
|
|
50
51
|
def is_metric(self) -> bool:
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: geojson-diff
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary:
|
|
5
|
-
Author-email: Yusuf Eminoğlu <
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Compare two GeoJSON files feature by feature: added, removed, modified and moved features with tolerances in metres, text/JSON/Markdown/HTML map reports, a git diff driver and CI exit codes.
|
|
5
|
+
Author-email: Yusuf Eminoğlu <geospacephilo@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
7
|
-
Project-URL: Homepage, https://
|
|
8
|
-
Project-URL: Repository, https://
|
|
9
|
-
Project-URL:
|
|
10
|
-
Project-URL:
|
|
11
|
-
Project-URL: Changelog, https://
|
|
12
|
-
|
|
7
|
+
Project-URL: Homepage, https://gitlab.com/geophilo1/geojson_diff_sdk
|
|
8
|
+
Project-URL: Repository, https://gitlab.com/geophilo1/geojson_diff_sdk
|
|
9
|
+
Project-URL: Documentation, https://gitlab.com/geophilo1/geojson_diff_sdk#readme
|
|
10
|
+
Project-URL: Issues, https://gitlab.com/geophilo1/geojson_diff_sdk/-/work_items
|
|
11
|
+
Project-URL: Changelog, https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/CHANGELOG.md
|
|
12
|
+
Project-URL: SDK dashboard, https://geophilo.com/sdk-dashboard/
|
|
13
|
+
Project-URL: DOI, https://doi.org/10.5281/zenodo.24063377
|
|
14
|
+
Keywords: geojson,geojson-diff,diff,compare-geojson,change-detection,git-diff,code-review,pull-request,data-pipeline,data-quality,hausdorff,geojsonseq,leaflet,gis
|
|
13
15
|
Classifier: Development Status :: 4 - Beta
|
|
14
16
|
Classifier: Programming Language :: Python :: 3
|
|
15
17
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -25,6 +27,7 @@ Classifier: Topic :: Software Development :: Version Control :: Git
|
|
|
25
27
|
Classifier: Topic :: Utilities
|
|
26
28
|
Classifier: Intended Audience :: Science/Research
|
|
27
29
|
Classifier: Intended Audience :: Developers
|
|
30
|
+
Classifier: Intended Audience :: Education
|
|
28
31
|
Classifier: Typing :: Typed
|
|
29
32
|
Requires-Python: >=3.9
|
|
30
33
|
Description-Content-Type: text/markdown
|
|
@@ -38,12 +41,18 @@ Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
|
38
41
|
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
39
42
|
Dynamic: license-file
|
|
40
43
|
|
|
44
|
+
<p align="center">
|
|
45
|
+
<a href="https://geophilo.com/sdk-dashboard/"><img src="https://geophilo.com/assets/sdk_icons/geojson_diff_sdk.svg" width="120" height="120" alt="geojson-diff icon"></a>
|
|
46
|
+
</p>
|
|
47
|
+
|
|
41
48
|
# geojson-diff
|
|
42
49
|
|
|
43
|
-
[](LICENSE)
|
|
50
|
+
[](https://pypi.org/project/geojson-diff/)
|
|
51
|
+
[](https://pypi.org/project/geojson-diff/)
|
|
52
|
+
[](https://gitlab.com/geophilo1/geojson_diff_sdk/-/pipelines)
|
|
53
|
+
[](https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/LICENSE)
|
|
54
|
+
[](https://doi.org/10.5281/zenodo.24063377)
|
|
55
|
+
[](https://pepy.tech/project/geojson-diff)
|
|
47
56
|
|
|
48
57
|
**Feature-level diffs of GeoJSON datasets** for GIS and data teams that review
|
|
49
58
|
changes in git, pull requests and data pipelines.
|
|
@@ -84,7 +93,7 @@ geojson-diff old.geojson new.geojson [--key id] [--tolerance 0.5m] \
|
|
|
84
93
|
[--format text|json|md|geojson|html] [-o out]
|
|
85
94
|
```
|
|
86
95
|
|
|
87
|
-
Using the two files in [`examples/`](examples):
|
|
96
|
+
Using the two files in [`examples/`](https://gitlab.com/geophilo1/geojson_diff_sdk/-/tree/main/examples):
|
|
88
97
|
|
|
89
98
|
```console
|
|
90
99
|
$ geojson-diff parcels_v1.geojson parcels_v2.geojson --tolerance 0.5m
|
|
@@ -358,7 +367,7 @@ optional `:N` allowance (exit 1 when the count exceeds N; default 0).
|
|
|
358
367
|
|
|
359
368
|
### GitHub Actions: post the summary on pull requests
|
|
360
369
|
|
|
361
|
-
[`examples/github-actions/geojson-diff.yml`](examples/github-actions/geojson-diff.yml)
|
|
370
|
+
[`examples/github-actions/geojson-diff.yml`](https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/examples/github-actions/geojson-diff.yml)
|
|
362
371
|
diffs every changed `*.geojson` file between the pull-request base and head, posts a
|
|
363
372
|
single Markdown comment (updated on later pushes), copies it to the job summary and
|
|
364
373
|
fails the check when features were removed. The core of it:
|
|
@@ -464,15 +473,35 @@ With `pip install "geojson-diff[shapely]"` and `--shapely` (`use_shapely=True`):
|
|
|
464
473
|
## Development
|
|
465
474
|
|
|
466
475
|
```bash
|
|
476
|
+
git clone https://gitlab.com/geophilo1/geojson_diff_sdk.git
|
|
477
|
+
cd geojson_diff_sdk
|
|
467
478
|
python -m pip install -e ".[dev,shapely]"
|
|
468
479
|
python -m pytest --cov=geojson_diff
|
|
469
480
|
python -m ruff check . && python -m ruff format --check src tests
|
|
470
481
|
python -m mypy src
|
|
471
482
|
```
|
|
472
483
|
|
|
484
|
+
## Related Geophilo SDKs
|
|
485
|
+
|
|
486
|
+
- [geofix](https://pypi.org/project/geofix/): validate and repair GeoJSON (RFC 7946) for local runs, pre-commit and CI.
|
|
487
|
+
- [geocsv](https://pypi.org/project/geocsv/): convert CSV and spreadsheet exports of places into validated GeoJSON, GeoPackage, KML or GPX.
|
|
488
|
+
- [poi-dedupe](https://pypi.org/project/poi-dedupe/): deduplicate and conflate points of interest with spatial blocking and fuzzy matching.
|
|
489
|
+
- [gpkglite](https://pypi.org/project/gpkglite/): read, write and validate OGC GeoPackage files in pure Python.
|
|
490
|
+
|
|
473
491
|
## License and citation
|
|
474
492
|
|
|
475
|
-
|
|
476
|
-
|
|
493
|
+
```bibtex
|
|
494
|
+
@software{eminoglu_geojson_diff,
|
|
495
|
+
author = {Eminoğlu, Yusuf},
|
|
496
|
+
title = {geojson-diff},
|
|
497
|
+
year = {2026},
|
|
498
|
+
version = {0.1.2},
|
|
499
|
+
doi = {10.5281/zenodo.24063377},
|
|
500
|
+
url = {https://doi.org/10.5281/zenodo.24063377}
|
|
501
|
+
}
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
MIT License - see [LICENSE](https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/LICENSE). If you use `geojson-diff` in research, please
|
|
505
|
+
cite it using [CITATION.cff](https://gitlab.com/geophilo1/geojson_diff_sdk/-/blob/main/CITATION.cff).
|
|
477
506
|
|
|
478
507
|
Author: Yusuf Eminoğlu
|
|
@@ -239,8 +239,21 @@ def test_module_entry_point(files):
|
|
|
239
239
|
env=env,
|
|
240
240
|
check=False,
|
|
241
241
|
)
|
|
242
|
-
|
|
242
|
+
from geojson_diff import __version__
|
|
243
|
+
|
|
244
|
+
assert version.stdout.decode().strip().startswith(f"geojson-diff {__version__}")
|
|
243
245
|
|
|
244
246
|
|
|
245
247
|
def test_exit_code_constants():
|
|
246
248
|
assert (cli.EXIT_OK, cli.EXIT_CHANGES, cli.EXIT_ERROR) == (0, 1, 2)
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
@pytest.mark.parametrize(
|
|
252
|
+
"args", [["--precision", "-1"], ["--precision", "x"], ["--max-rows", "-3"]]
|
|
253
|
+
)
|
|
254
|
+
def test_out_of_range_numeric_options_are_usage_errors(pair, args, capsys):
|
|
255
|
+
old, new = pair(fc(), fc())
|
|
256
|
+
with pytest.raises(SystemExit) as exc:
|
|
257
|
+
main([str(old), str(new), *args])
|
|
258
|
+
assert exc.value.code == 2
|
|
259
|
+
assert "error: argument" in capsys.readouterr().err
|
|
@@ -313,3 +313,20 @@ def test_result_summary_and_deltas():
|
|
|
313
313
|
assert all("feature" not in c for c in light["changes"])
|
|
314
314
|
empty = diff(fc(), fc())
|
|
315
315
|
assert not empty.has_changes and empty.bbox is None and empty.units == "m"
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
@pytest.mark.parametrize(
|
|
319
|
+
"kwargs",
|
|
320
|
+
[
|
|
321
|
+
{"precision": -1},
|
|
322
|
+
{"precision": 16},
|
|
323
|
+
{"precision": 2.5},
|
|
324
|
+
{"min_score": 1.5},
|
|
325
|
+
{"min_score": float("nan")},
|
|
326
|
+
],
|
|
327
|
+
)
|
|
328
|
+
def test_invalid_options_are_rejected(kwargs):
|
|
329
|
+
# Regression: precision=-1 rounded hashes to tens of degrees and matched
|
|
330
|
+
# unrelated features; a NaN min_score silently dropped every spatial match.
|
|
331
|
+
with pytest.raises(ValueError):
|
|
332
|
+
diff(fc(), fc(), **kwargs)
|
|
@@ -209,3 +209,14 @@ def test_script_json_escapes():
|
|
|
209
209
|
def test_unknown_format(result):
|
|
210
210
|
with pytest.raises(ValueError):
|
|
211
211
|
render(result, "pdf")
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def test_negative_max_rows_lists_no_rows():
|
|
215
|
+
# Regression: max_rows=-1 sliced from the end and printed a wrong "more" count.
|
|
216
|
+
old = fc(feature(point(0, 0), 1), feature(point(1, 1), 2))
|
|
217
|
+
new = fc(feature(point(0, 0), 1))
|
|
218
|
+
result = diff(old, new)
|
|
219
|
+
md = render(result, "md", max_rows=-1)
|
|
220
|
+
assert "1 more" in md and "-" + "1 more" not in md
|
|
221
|
+
page = render(result, "html", max_rows=-5)
|
|
222
|
+
assert "1 more changes" in page
|
|
@@ -23,6 +23,8 @@ from geojson_diff import io as gio
|
|
|
23
23
|
("1e-6deg", 1e-6, "deg"),
|
|
24
24
|
("0.0001°", 0.0001, "deg"),
|
|
25
25
|
("0.001", 0.001, "deg"),
|
|
26
|
+
("1.m", 1.0, "m"), # regression: a trailing decimal point was rejected
|
|
27
|
+
(".5m", 0.5, "m"),
|
|
26
28
|
(0.25, 0.25, "deg"),
|
|
27
29
|
(None, 0.0, "m"),
|
|
28
30
|
],
|
|
@@ -33,7 +35,7 @@ def test_parse_tolerance(text, value, unit):
|
|
|
33
35
|
assert tol.value == pytest.approx(value)
|
|
34
36
|
|
|
35
37
|
|
|
36
|
-
@pytest.mark.parametrize("bad", ["abc", "1 parsec", "-1m", True])
|
|
38
|
+
@pytest.mark.parametrize("bad", ["abc", "1 parsec", "-1m", True, ".m", float("inf"), "1e999m"])
|
|
37
39
|
def test_parse_tolerance_rejects(bad):
|
|
38
40
|
with pytest.raises(ValueError):
|
|
39
41
|
parse_tolerance(bad)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|