{"id":18720036,"url":"https://github.com/geops/pysnapping","last_synced_at":"2025-10-25T04:02:18.610Z","repository":{"id":137740484,"uuid":"587772999","full_name":"geops/pysnapping","owner":"geops","description":"Mirror from internal gitlab repository","archived":false,"fork":false,"pushed_at":"2025-03-04T10:17:42.000Z","size":270,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-22T23:59:21.155Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-01-11T14:54:58.000Z","updated_at":"2025-05-22T09:15:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"628dac1b-fb94-459f-9cab-54c70af93842","html_url":"https://github.com/geops/pysnapping","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/geops/pysnapping","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geops%2Fpysnapping","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geops%2Fpysnapping/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geops%2Fpysnapping/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geops%2Fpysnapping/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geops","download_url":"https://codeload.github.com/geops/pysnapping/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geops%2Fpysnapping/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280901420,"owners_count":26410586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T13:29:11.316Z","updated_at":"2025-10-25T04:02:18.568Z","avatar_url":"https://github.com/geops.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PySnapping\n\nSnap points to a line string keeping a given order or spacing intact.\n\nThe PySnapping python library helps to solve the problem of snapping an ordered sequence of points\nto a line string, respecting the given input order.\n\nThe motivation for this library is to solve the problem of snapping stops onto vehicle trajectories\nin the [GTFS format](https://gtfs.org/) with inaccurate or missing kilometrage.\n\nIn order to be able to work with metric parameters and to treat data with large extent located\nanywhere on the world, we use the [EPSG:4978](https://epsg.io/4978) Cartesian 3D geocentric coordinate system\nfor the internal representation.\n\nThe library aims to automatically classify kilometrage information as trusted or\nuntrusted. Trusted points are always snapped as given by the kilometrage. In between\ntrusted points, untrusted points are snapped by minimizing the sum of square snapping\ndistances among all admissible solutions within certain radii. Admissible solutions are\nthose that respect the order and minimum spacing between points.\n\n## Installation\n\nInstall the latest stable release from PyPI with pip:\n\n```bash\npip install pysnapping\n```\n\n## Modules\n\n### Linear Referencing\n\nThe `pysnapping.linear_referencing` module contains low-level classes and functions for referencing points along\nlinear features in N-dimensions built on top of `numpy`. This contains interpolation/extrapolation along a line string\nand data structures optimized for projecting points to substrings of a line string.\n\n### Utils\n\nThe `pysnapping.util` module contains common helper functions used in other parts of the library.\n\n### Snapping\n\nThe `pysnapping.snap` module is the main entry point for users of the `pysnapping` library and\nprovides the classes needed to use the library.\n\n### Statistics\n\nThe `pysnapping.stats` module provides tools to aggregate statistics about snapping\nfailures and the methods used in case of success.\n\n## Usage\n\nThe typical usage pattern is to create a `pysnapping.snap.DubiousTrajectory` instance which represents\na vehicle trajectory with dubious kilometrage and a `pysnapping.snap.DubiousTrajectoryTrip` `dtrip` which represents\na trip along such a trajectory with dubious kilometrage for the stops.\nThen `dtrip.to_trajectory_trip` can be used to get a `pysnapping.snap.TrajectorTrip` `trip` with well defined\nmetric kilometrage. `trip.trajectory` then refers to a `pysnapping.snap.Trajectory` instance with well defined metric\nkilometrage.\n\nThe `trip.snap_trip_points` method can be used to snap the trip points onto the\ntrajectory, resulting in a `pysnapping.snap.SnappedTripPoints` instance `snapped`. Then\nyou can e.g. split the trajectory at the stops using the\n`snapped.get_inter_point_ls_coords_in_travel_direction` method. Snapping can be\ncontrolled with parameters given by a `pysnapping.snap.SnappingParams` instance.\n\nA more detailed usage example (e.g. how to process GTFS input) is planned but not available yet.\nUntil then, please also check the docstrings and source code for additional usage hints/possibilities.\n\n## Issue Tracker\n\nPlease use [the GitHub issue tracker](https://github.com/geops/pysnapping/issues) to report bugs/issues.\n\n## Development\n\n### Contributing\n\nIf you want to contribute to the pysnapping library, you can make a pull request at [GitHub](https://github.com/geops/pysnapping).\nBefore working on major features/changes, please consider contacting us about your plans.\nSee [our GitHub page](https://github.com/geops) for contact details.\n\n### Editable Installation\n\nClone this repo and enter the corresponding directory.\nCreate a virtual environment, then install frozen requirements, dev-requirements\nand this library in editable mode:\n\n```bash\npython3.9 -m venv env\n. env/bin/activate\npip install -U pip\npip install -r requirements.txt -r dev-requirements.txt -e .\n```\n\nKeep env activated for all following instructions.\n\n### Pre-Commit Hooks\n\nEnable pre-commit hooks:\n\n```bash\npre-commit install\n```\n\nFrom time to time (not automated yet) run\n\n```bash\npre-commit autoupdate\n```\n\nto update frozen revs.\n\n### Run Tests\n\nRun tests and analyze code coverage:\n\n```bash\npytest --cov=pysnapping --cov-report term --cov-fail-under=85 pysnapping\n```\n\n## Changelog\n\n### v0.2.0\n\n#### Breaking Changes\n\n* Snapping for untrusted points is now done by an exact algorithm instead of the\n  iterative approximate solution. This implies breaking changes to the parameters in\n  `snap.SnappingParams` as well as to parts of the API of the classes in the `snap`\n  module. For example: Timing information to guide the initial conditions of the\n  iterative solution is not necessary and thus not supported any more.\n* The `ordering` module has been removed since it is not needed any more.\n\n#### Other Changes:\n\n* The development toolchain now uses ruff where possible.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeops%2Fpysnapping","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeops%2Fpysnapping","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeops%2Fpysnapping/lists"}