{"id":22477128,"url":"https://github.com/zorapeteri/gtfs-polygon-filter","last_synced_at":"2025-03-27T17:44:04.582Z","repository":{"id":177713740,"uuid":"660808000","full_name":"zorapeteri/gtfs-polygon-filter","owner":"zorapeteri","description":"Filters routes in a GTFS feed that overlap with a GeoJSON polygon","archived":false,"fork":false,"pushed_at":"2023-07-01T09:10:31.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-03T11:46:15.299Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/zorapeteri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-06-30T22:47:05.000Z","updated_at":"2023-06-30T22:47:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"752ff240-11d2-415f-85ee-9c05ac40c7ac","html_url":"https://github.com/zorapeteri/gtfs-polygon-filter","commit_stats":null,"previous_names":["zorapeteri/gtfs-polygon-filter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zorapeteri%2Fgtfs-polygon-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zorapeteri%2Fgtfs-polygon-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zorapeteri%2Fgtfs-polygon-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zorapeteri%2Fgtfs-polygon-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zorapeteri","download_url":"https://codeload.github.com/zorapeteri/gtfs-polygon-filter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245897297,"owners_count":20690455,"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":[],"created_at":"2024-12-06T14:09:35.900Z","updated_at":"2025-03-27T17:44:04.576Z","avatar_url":"https://github.com/zorapeteri.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## gtfs-polygon-filter\n\nFilters routes in a GTFS feed based on whether they overlap with a GeoJSON Polygon (or MultiPolygon).\n\nIt includes a route in the returned array, if `overlapRatio` (0.5 by default) of the stops on the route are within the bounds of any of the provided polygons.\n\nWorks with [`node-gtfs`](https://github.com/blinktaginc/node-gtfs), requires an already open database connection to work.\n\n### install\n\n`npm i gtfs-polygon-filter`\n\n### use\n\n```js\nimport gtfsPolygonFilter from 'gtfs-polygon-filter'\nimport { openDb } from 'gtfs'\nimport totallyAwesomePolygyon from './somewhere'\n\nopenDb(config) // see how to do this in node-gtfs readme\n\nconst routesThatAreAtLeastTwoThirdsInsideMyPolygon = await gtfsPolygonFilter({\n  polygon: totallyAwesomePolygon,\n  routesFilter: {\n    agency_id: '123', // gets passed into gtfs/getRoutes, to avoid looping through all routes in GTFS feed\n  },\n  overlapRatio: 0.67,\n})\n\n// [\n//   {\n//     route_id: 'cool_route',\n//     agency_id: '123',\n//     route_short_name: 'Cool Route',\n//     ...\n//   },\n// ]\n```\n\nMore detailed example [here](https://github.com/zorapeteri/gtfs-polygon-filter/tree/main/example)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzorapeteri%2Fgtfs-polygon-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzorapeteri%2Fgtfs-polygon-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzorapeteri%2Fgtfs-polygon-filter/lists"}