Skip to content

Commit 3979c7f

Browse files
feat(distance): add Distance API support (#21)
* feat(distance): add Distance API support Add full Distance API support matching the PHP SDK implementation: - Add Coordinate class for flexible coordinate input formats (string, tuple, dict) - Add distance() method for single origin to multiple destinations (GET) - Add distance_matrix() method for multiple origins × destinations (POST) - Add async job methods for large distance matrix calculations: - create_distance_matrix_job() - distance_matrix_job_status() - distance_matrix_jobs() - get_distance_matrix_job_results() - download_distance_matrix_job() - delete_distance_matrix_job() - Enhance geocode() and reverse() with distance parameters - Add type-safe constants for mode, units, ordering, and sorting - Add verify_ssl parameter to client for testing with self-signed certs - Add comprehensive unit tests and E2E tests - Update README with full Distance API documentation All changes are backward compatible - existing code continues to work. * fix(tests): add __init__.py to test subdirectories Prevents pytest module name collision between unit and e2e test files with the same name (e.g., test_distance.py in both directories). * fix(tests): correct distance API test assertion for origin ID The API does not return origin ID for GET /distance requests, only destination IDs. Updated test to verify destination IDs instead. * fix(distance): remove unused f-string prefixes * chore: prepare release v0.5.0 - Bump version to 0.5.0 - Update CHANGELOG with Distance API features --------- Co-authored-by: Mathias Hansen <me@codemonkey.io>
1 parent 939c0be commit 3979c7f

12 files changed

Lines changed: 2531 additions & 63 deletions

File tree

CHANGELOG.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.5.0] - 2026-01-06
11+
12+
### Added
13+
- **Distance API support** with new methods for calculating distances between coordinates:
14+
- `distance()` - Calculate distances from a single origin to multiple destinations
15+
- `distance_matrix()` - Calculate distances from multiple origins to multiple destinations
16+
- Support for `straightline` (haversine) and `driving` distance modes
17+
- Support for `miles` and `km` units
18+
- Optional sorting by distance or duration
19+
- New `Coordinate` class for representing geographic coordinates with optional IDs
20+
- Distance parameters for `geocode()` and `reverse()` methods to calculate distances inline
21+
- Comprehensive type definitions: `DistanceResponse`, `DistanceMatrixResponse`, `DistanceOrigin`, `DistanceDestination`
22+
- Distance mode constants: `DISTANCE_MODE_STRAIGHTLINE`, `DISTANCE_MODE_DRIVING`
23+
- Distance unit constants: `DISTANCE_UNITS_MILES`, `DISTANCE_UNITS_KM`
24+
1025
## [0.2.0] - 2025-08-08
1126

1227
### Changed
@@ -39,6 +54,7 @@ When ready to release:
3954
5. Push tags: `git push --tags`
4055
6. GitHub Actions will automatically publish to PyPI
4156

42-
[Unreleased]: https://github.com/Geocodio/geocodio-library-python/compare/v0.2.0...HEAD
57+
[Unreleased]: https://github.com/Geocodio/geocodio-library-python/compare/v0.5.0...HEAD
58+
[0.5.0]: https://github.com/Geocodio/geocodio-library-python/compare/v0.4.0...v0.5.0
4359
[0.2.0]: https://github.com/Geocodio/geocodio-library-python/compare/v0.1.0...v0.2.0
4460
[0.1.0]: https://github.com/Geocodio/geocodio-library-python/releases/tag/v0.1.0

0 commit comments

Comments
 (0)