{"id":20277426,"url":"https://github.com/ekspla/douglas-peucker_n","last_synced_at":"2026-05-05T16:05:41.593Z","repository":{"id":166680701,"uuid":"642187637","full_name":"ekspla/Douglas-Peucker_N","owner":"ekspla","description":"Reduce gpx track points using Douglas-Peucker N","archived":false,"fork":false,"pushed_at":"2023-08-21T06:23:08.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-14T06:47:39.461Z","etag":null,"topics":["douglas-peucker","douglas-peucker-n","gpx","python"],"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/ekspla.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}},"created_at":"2023-05-18T02:37:14.000Z","updated_at":"2023-10-26T03:32:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"cba71375-619f-461e-87f2-7156e4301c70","html_url":"https://github.com/ekspla/Douglas-Peucker_N","commit_stats":null,"previous_names":["ekspla/douglas-peucker_n"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekspla%2FDouglas-Peucker_N","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekspla%2FDouglas-Peucker_N/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekspla%2FDouglas-Peucker_N/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekspla%2FDouglas-Peucker_N/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ekspla","download_url":"https://codeload.github.com/ekspla/Douglas-Peucker_N/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241768289,"owners_count":20017129,"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","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":["douglas-peucker","douglas-peucker-n","gpx","python"],"created_at":"2024-11-14T13:18:25.309Z","updated_at":"2026-05-05T16:05:41.542Z","avatar_url":"https://github.com/ekspla.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Douglas-Peucker_N\n\n**Reduce gpx track points to a target number of points** by using [Douglas-Peucker N algorithm](https://psimpl.sourceforge.net/douglas-peucker.html).  \n\nMay 2023, a quick [python port](https://github.com/ekspla/Douglas-Peucker_N) by ekspla.  \nRequires [gpxpy](https://github.com/tkrajina/gpxpy) or [lxml](https://pypi.org/project/lxml/).  \n\n[Original version written in JavaScript](https://github.com/330k/gpx_tools) by 330k.  \n\n## Introduction\nThis is a faster algorithm to reduce size of a track as compared to [simplify--crosstrack in gpsbabel](https://www.gpsbabel.org/htmldoc-1.8.0/filter_simplify.html). \nI found it useful for processing tracks/routes before installing them into small navigation devices.\n\nProcessing time was measured using my core i5 (gen4) PC with CPython 3.9 and compared with those of gpsbabel.\nIt took less than 1 sec to reduce 78252 of trackpoints ([a sample file in 330k's web site](https://github.com/330k/gpx_tools)) to 2000 points, surprisingly faster than 23 sec with gpsbabel.\n\n## Coordinate transformations used in the scripts\n- `reduce_points.py`  \n  (x, y) = Mercator_projection **(latitude, longitude)**; assuming sphere.\n- `reduce_points_3d.py`  \n  (x, y, z) = Cartesian **(latitude, longitude, altitude)**; assuming ellipsoid.  \n  This script may be useful if the track/route passes a hill top.\n- `reduce_points_2dt.py`  \n  (x, y) = Mercator_projection **(latitude, longitude)**; assuming sphere.  \n  z = **time** * Average_speed  \n  This script may be useful in processing real gps tracks **with timestamps**.\n\n## How to use\n**An example to process tracks** is shown in **reduce_points()**.  For routes/waypoints, modify the codes in that function.\n\nIf you want to use them with **lxml**, examples are shown in **./lxml**.\n\n## Reference\n[1] https://www.gpsbabel.org/htmldoc-1.8.0/filter_simplify.html\n\n[2] https://github.com/330k/gpx_tools\n\n[3] https://330k.github.io/line_simplify_demo/gpx_visual_simplify.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekspla%2Fdouglas-peucker_n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fekspla%2Fdouglas-peucker_n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekspla%2Fdouglas-peucker_n/lists"}