{"id":13426220,"url":"https://github.com/placemark/togeojson","last_synced_at":"2026-01-14T03:26:21.635Z","repository":{"id":37851630,"uuid":"166107133","full_name":"placemark/togeojson","owner":"placemark","description":"convert KML, TCX, and GPX to GeoJSON, without the fuss","archived":false,"fork":true,"pushed_at":"2025-05-31T17:10:03.000Z","size":6915,"stargazers_count":431,"open_issues_count":13,"forks_count":68,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-10-20T14:57:03.088Z","etag":null,"topics":["geojson","gpx","kml","tcx"],"latest_commit_sha":null,"homepage":"https://placemark.github.io/togeojson/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mapbox/togeojson","license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/placemark.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2019-01-16T20:29:19.000Z","updated_at":"2025-10-01T20:08:35.000Z","dependencies_parsed_at":"2023-07-18T02:49:44.292Z","dependency_job_id":null,"html_url":"https://github.com/placemark/togeojson","commit_stats":null,"previous_names":["tmcw/togeojson"],"tags_count":73,"template":false,"template_full_name":null,"purl":"pkg:github/placemark/togeojson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/placemark%2Ftogeojson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/placemark%2Ftogeojson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/placemark%2Ftogeojson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/placemark%2Ftogeojson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/placemark","download_url":"https://codeload.github.com/placemark/togeojson/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/placemark%2Ftogeojson/sbom","scorecard":{"id":736700,"data":{"date":"2025-08-11","repo":{"name":"github.com/placemark/togeojson","commit":"b99baa6e74fc528648353d081411db56fe84283c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":3,"reason":"2 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/placemark/togeojson/nodejs.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/nodejs.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/placemark/togeojson/nodejs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/placemark/togeojson/nodejs.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 2-Clause \"Simplified\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":3,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'main'","Info: 'force pushes' disabled on branch 'main'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'main'","Warn: could not determine whether codeowners review is allowed","Warn: no status checks found to merge onto branch 'main'","Warn: PRs are not required to make changes on branch 'main'; or we don't have data to detect it.If you think it might be the latter, make sure to run Scorecard with a PAT or use Repo Rules (that are always public) instead of Branch Protection settings"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 15 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":3,"reason":"7 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-x574-m823-4x7w","Warn: Project is vulnerable to: GHSA-4r4m-qw57-chr8","Warn: Project is vulnerable to: GHSA-xcj6-pq6g-qj4x","Warn: Project is vulnerable to: GHSA-356w-63v5-8wf4","Warn: Project is vulnerable to: GHSA-859w-5945-r5v3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T16:06:17.781Z","repository_id":37851630,"created_at":"2025-08-22T16:06:17.782Z","updated_at":"2025-08-22T16:06:17.782Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"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":["geojson","gpx","kml","tcx"],"created_at":"2024-07-31T00:01:29.327Z","updated_at":"2026-01-14T03:26:21.617Z","avatar_url":"https://github.com/placemark.png","language":"TypeScript","funding_links":[],"categories":["JavaScript","TypeScript"],"sub_categories":[],"readme":"# Convert KML, GPX, and TCX to GeoJSON.\n\n[![NPM Version](https://img.shields.io/npm/v/%40tmcw%2Ftogeojson)](https://www.npmjs.com/package/@tmcw/togeojson)\n\n_togeojson development is supported by 🌎 [placemark.io](https://placemark.io/)_\n\nThis converts [KML](https://developers.google.com/kml/documentation/), [TCX](https://en.wikipedia.org/wiki/Training_Center_XML), \u0026 [GPX](http://www.topografix.com/gpx.asp)\nto [GeoJSON](http://www.geojson.org/), in a browser or with [Node.js](http://nodejs.org/).\n\n- [x] Dependency-free\n- [x] Tiny\n- [x] Tested\n- [x] Node.js + Browsers\n\n## [📕 API Documentation](http://togeojson.docs.placemark.io/)\n\n_This is a JavaScript library that lets projects convert KML and GPX to GeoJSON. If you're\nlooking for a command line too, use [@tmcw/togeojson-cli](https://github.com/tmcw/togeojson-cli). If you\nwant to convert one KML or GPX file, use [my online tool](https://observablehq.com/@tmcw/convert-kml-to-geojson).\nIf you want to convert another format, consider [GDAL](https://www.gdal.org/)._\n\n## Property conversions\n\nIn addition to converting KML’s `\u003cExtendedData\u003e` verbatim, @tmcw/togeojson\nalso encodes parts of KML, GPX, and TCX files that otherwise would be lost.\n\n**KML**\n\n- Style properties: `fill-color`, `fill-opacity`, `stroke`, `stroke-opacity`,\n  `icon-color`, `icon-opacity`, `label-color`, `label-opacity`, `icon-scale`,\n  `icon-heading`, `icon-offset`, `icon-offset-units`\n\n**GPX**\n\n- Style properties: `stroke`, `stroke-opacity`, `stroke-width`\n\n**TCX**\n\n- Line properties: `totalTimeSeconds`, `distanceMeters`, `maxSpeed`,\n  `avgHeartRate`, `maxHeartRate`, `avgSpeed`, `avgWatts`, `maxWatts`\n\nThis also emits the [geojson-coordinate-properties](https://github.com/mapbox/geojson-coordinate-properties) format\nto include time and other attributes that apply to each coordinate of a LineString.\n\n## Ground overlays\n\n[Example of working with Ground Overlays in Mapbox GL JS](https://observablehq.com/@tmcw/togeojson-kml-ground-overlay-support)\n\nKML GroundOverlays are now supported, and transformed into Features\nwith Polygon geometries. They have two defined properties:\n\n```json\n{\n  \"@geometry-type\": \"groundoverlay\",\n  \"icon\": \"https://url.to.image…\"\n}\n```\n\nBoth `gx:LatLonQuad` and `LatLonBox`-based ground overlays are supported.\n\n## TypeScript\n\nIf you're using this with TypeScript, you'll want to also install:\n\n- `@types/geojson`\n- `@xmldom/xmldom`\n\nThese will give you accurate types for both input and output\ntypes. Due to TypeScript limitations, it's currently necessary\nto install `@xmldom/xmldom` for accurate input types even\nif you aren't using that module for parsing XML.\nIf you have ideas for how to improve this, please\n[comment on this PR!](https://github.com/placemark/togeojson/pull/138).\n\n## CLI\n\nUse [@tmcw/togeojson-cli](https://github.com/tmcw/togeojson-cli) to use this\nsoftware as a command-line tool.\n\n## Node.js\n\nInstall it into your project with `npm install --save @tmcw/togeojson`.\n\n```javascript\n// using togeojson in nodejs\n\nconst tj = require(\"@tmcw/togeojson\");\nconst fs = require(\"fs\");\n// node doesn't have xml parsing or a dom. use xmldom\nconst DOMParser = require(\"xmldom\").DOMParser;\n\nconst kml = new DOMParser().parseFromString(fs.readFileSync(\"foo.kml\", \"utf8\"));\n\nconst converted = tj.kml(kml);\n```\n\n## ES Modules\n\n```javascript\n// The ES Module provides named exports, to import kml, gpx,\n// and other parts of the module by name.\nimport { kml } from \"@tmcw/togeojson\";\n```\n\n## Browser\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { kml } from \"https://unpkg.com/@tmcw/togeojson?module\";\n\n  fetch(\"test/data/linestring.kml\")\n    .then(function (response) {\n      return response.text();\n    })\n    .then(function (xml) {\n      console.log(kml(new DOMParser().parseFromString(xml, \"text/xml\")));\n    });\n\u003c/script\u003e\n```\n\n### KML Feature Support\n\n- [x] Point\n- [x] Polygon\n- [x] LineString\n- [x] name \u0026 description\n- [x] ExtendedData\n- [x] SimpleData\n- [x] MultiGeometry -\u003e GeometryCollection\n- [x] Styles\n- [x] Tracks \u0026 MultiTracks with `gx:coords`, including altitude\n- [x] [TimeSpan](https://developers.google.com/kml/documentation/kmlreference#timespan)\n- [x] [TimeStamp](https://developers.google.com/kml/documentation/kmlreference#timestamp)\n- [x] Folders (with kmlWithFolders)\n- [x] GroundOverlays\n- [ ] NetworkLinks\n\n### GPX Feature Support\n\n- [x] Line Paths\n- [x] Line styles\n- [ ] Properties\n  - [x] 'name', 'cmt', 'desc', 'link', 'time', 'keywords', 'sym', 'type' tags\n  - [x] gpxx Garmin extensions on tracks and routes\n  - [ ] 'author', 'copyright' tags\n\n## FAQ\n\n### How does this differ from mapbox/togeojson?\n\n- This repository is maintained.\n- It’s available as an ES Module. If you're using a modern JavaScript bundler or\n  using ES Modules in the browser, this makes it a bit more efficient and sometimes\n  easier to use.\n- Conversion methods are available as generators, which makes the conversion of big\n  files more efficient.\n- The command line utility was moved to [tmcw/togeojson-cli](https://github.com/tmcw/togeojson-cli),\n  which lets this module enjoy reduced dependencies: installing @tmcw/togeojson doesn’t\n  require any other dependencies.\n\n### Why doesn't toGeoJSON support NetworkLinks?\n\nThe NetworkLink KML construct allows KML files to refer to other online\nor local KML files for their content. It's often used to let people pass around\nfiles but keep the actual content on servers.\n\nIn order to support NetworkLinks, toGeoJSON would need to be asynchronous\nand perform network requests. These changes would make it more complex and less\nreliable in order to hit a limited usecase - we'd rather keep it simple\nand not require users to think about network connectivity and bandwith\nin order to convert files.\n\nNetworkLink support could be implemented in a separate library as a pre-processing\nstep if desired.\n\n### Should toGeoJSON support feature X from KML?\n\nThis module should support converting all KML and GPX features that have commonplace\nequivalents in GeoJSON.\n\n## Protips:\n\nHave a string of XML and need an XML DOM? There are two main options:\n\n- Use [xmldom](https://www.npmjs.com/package/@xmldom/xmldom), a JavaScript module that contains its own XML parser\n- Use [`DOMParser`](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser), the native platform XML parser\n\nWe recommend that **you use xmldom**, not the platform. DOMParser requires XML to be valid, which means that any XML namespaces that a KML, GPX, or TCX file contains are valid. A lot of existing data is invalid XML, and will be parsed only in part by DOMParser, but can be fully parsed by xmldom.\n\nUsing xmldom (recommended):\n\n```js\nconst xmldom = require(\"@xmldom/xmldom\");\nconst dom = new xmldom.DOMParser().parseFromString(xmlStr, \"text/xml\");\n```\n\nUsing DOMParser:\n\n```js\nvar dom = new DOMParser().parseFromString(xmlStr, \"text/xml\");\n```\n\n---\n\n[![Maintainability](https://api.codeclimate.com/v1/badges/b3673a9a9f6e132ec991/maintainability)](https://codeclimate.com/github/placemark/togeojson/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/b3673a9a9f6e132ec991/test_coverage)](https://codeclimate.com/github/placemark/togeojson/test_coverage)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplacemark%2Ftogeojson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplacemark%2Ftogeojson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplacemark%2Ftogeojson/lists"}