{"id":20442445,"url":"https://github.com/plibither8/geosvg","last_synced_at":"2025-04-12T23:33:53.511Z","repository":{"id":57249964,"uuid":"448114042","full_name":"plibither8/geosvg","owner":"plibither8","description":"🗺 Generate an SVG or its Cartesian points' representation of a path from a GPX file or list of coordinates","archived":false,"fork":false,"pushed_at":"2022-01-17T14:38:32.000Z","size":81,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T23:33:45.582Z","etag":null,"topics":["cartesian","coordinates","gpx","svg"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/geosvg","language":"TypeScript","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/plibither8.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}},"created_at":"2022-01-14T21:37:44.000Z","updated_at":"2022-12-29T15:47:43.000Z","dependencies_parsed_at":"2022-09-09T00:50:34.795Z","dependency_job_id":null,"html_url":"https://github.com/plibither8/geosvg","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plibither8%2Fgeosvg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plibither8%2Fgeosvg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plibither8%2Fgeosvg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plibither8%2Fgeosvg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plibither8","download_url":"https://codeload.github.com/plibither8/geosvg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647259,"owners_count":21139081,"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":["cartesian","coordinates","gpx","svg"],"created_at":"2024-11-15T09:40:17.073Z","updated_at":"2025-04-12T23:33:53.491Z","avatar_url":"https://github.com/plibither8.png","language":"TypeScript","readme":"# geosvg\n\n\u003e 🗺 Generate SVGs or Cartesian points of a path from a GPX file or list of coordinates\n\nGet an SVG string, the svg's `path` string or list of Cartesian coordinates mapped to the path supplied by a GPX file or an array of geographical coordinates (lat/long).\n\n## Install\n\n```sh\n$ npm install geosvg\n```\n\n## Usage\n\n```ts\nimport geosvg from \"geosvg\";\n\n// Read the GPX string from a file first\nconst gpx = readFileSync(PATH_TO_GPX, \"utf-8\");\n// ...or directly create a list of coordinates\nconst coordinates = [\n  { latitude: 28.1234, longitude: 77.4567 },\n  { latitude: 28.1235, longitude: 77.4568 },\n  { latitude: 28.1236, longitude: 77.4569 },\n];\n\n// Get the SVG string\nconst svg = geosvg.fromGpx(gpx).toSvg();\nconst svg = geosvg.fromCoordinates(coordinates).toSvg();\n//=\u003e `\u003csvg xmlns=\"...\" width=\"...\" height=\"...\" viewBox=\"...\"\u003e\u003cpath d=\"...\" /\u003e\u003c/svg\u003e`\n\n// Get the SVG path string\nconst svgPath = geosvg.fromGpx(gpx).toSvgPath();\nconst svgPath = geosvg.fromCoordinates(coordinates).toSvgPath();\n//=\u003e { width: 1000, height: 1200, path: `M 296.072357,57.331839 C 295.681288,57.932999 294.762101...` }\n\n// Get the cartesian points\nconst points = geosvg.fromGpx(gpx).toCartesianDetails();\nconst points = geosvg.fromCoordinates(coordinates).toCartesianDetails();\n//=\u003e { width: 1000, height: 1200, points: [{ x: 300, y: 700 }, { x: 301, y: 700.25 }, ...] }\n```\n\n### Options\n\n#### `.toSvg(options?)`, `.toSvgPath(options?)`\n\n```ts\n{\n  smooth?: boolean = true; // whether to smoothen the lines or not\n  smoothing?: number = 0.2; // smoothening factor\n  accuracy?: number = 0.001; // accuracy of distance measurements\n  scale?: number = undefined; // max-dimensions to scale the svg too\n  svg?: {\n    width?: number = undefined; // width of the svg, ideally leave it undefined\n    height?: number = undefined; // height of the svg, ideally leave it undefined\n    stroke?: string = \"red\"; // stroke color of the svg\n    strokeWidth?: number = 4; // stroke with of the svg\n    strokeLinecap?: string = \"round\"; // stroke's line-cap style\n    strokeMiterlimit?: number = 4; // stroke's Miter limit\n    fill?: string = \"none\"; // whether to fill in the path with a color\n  };\n}\n```\n\n#### `.toCartesianDetails(options?)`\n\n```ts\n{\n  accuracy?: number = 0.001; // accuracy of distance measurements\n}\n```\n\n## License\n\n[MIT](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplibither8%2Fgeosvg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplibither8%2Fgeosvg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplibither8%2Fgeosvg/lists"}