{"id":13554946,"url":"https://github.com/developmentseed/dirty-reprojectors","last_synced_at":"2025-06-23T21:40:55.973Z","repository":{"id":13040802,"uuid":"73399275","full_name":"developmentseed/dirty-reprojectors","owner":"developmentseed","description":"Make quick and dirty projections to use in your web maps instead of Web Mercator","archived":false,"fork":false,"pushed_at":"2022-12-03T04:24:45.000Z","size":1159,"stargazers_count":120,"open_issues_count":22,"forks_count":10,"subscribers_count":49,"default_branch":"master","last_synced_at":"2025-06-06T23:17:19.631Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.developmentseed.org/dirty-reprojectors-app/","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/developmentseed.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":"2016-11-10T16:17:16.000Z","updated_at":"2024-08-29T13:41:50.000Z","dependencies_parsed_at":"2023-01-11T20:19:36.550Z","dependency_job_id":null,"html_url":"https://github.com/developmentseed/dirty-reprojectors","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/developmentseed/dirty-reprojectors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fdirty-reprojectors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fdirty-reprojectors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fdirty-reprojectors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fdirty-reprojectors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developmentseed","download_url":"https://codeload.github.com/developmentseed/dirty-reprojectors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fdirty-reprojectors/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261561181,"owners_count":23177543,"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-08-01T12:02:58.236Z","updated_at":"2025-06-23T21:40:55.945Z","avatar_url":"https://github.com/developmentseed.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","others"],"sub_categories":[],"readme":"# Dirty Reprojectors\n\nQuick and dirty re-projections to trick your web maps out of web mercator.\n\n## Install\n\n    npm install -g dirty-reprojectors\n\n## Usage\n\n### CLI\n\n    cat input.geojson | dirty-reproject --forward PROJECTION [--reverse PROJECTION=mercator] \u003e output.geojson\n\nExample: to reproject some geojson so that web mapping libraries will render it\nlooking like 'albersUsa':\n\n    cat input.geojson | dirty-reproject --forward albersUsa \u003e output.geojson\n\nFor a list of supported projections, `dirty-reproject --list`\n\n\n### API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n#### reproject\n\nReprojects the given geometry coordinate array _in place_, with\nunprojectable points or degenerate geometries removed. If both\n`options.forward` and `options.reverse` are supplied, then `forward` is\nperformed first.\n\n**Parameters**\n\n-   `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n    -   `options.forward` **([Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function) \\| [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))?** The forward projection to use.\n    -   `options.reverse` **([Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function) \\| [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))?** The reverse projection to use.\n    -   `options.projections` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** A map of named projections to use.  If provided, then string values of `options.forward` or `options.reverse` will be used as keys to look up the projection function in `options.projections`.  For an extensive list provided by d3-geo-projection, use `require('dirty-reprojectors/projections')`.\n-   `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** \n\n## How it works\n\nTake, for example:\n\n    cat input.geojson | dirty-reproject --forward albersUsa \u003e output.geojson\n\nWhat this actually does is:\n\n1. Project `input.geojson` from WGS 84 (longitude/latitude) into `albersUsa`, with the target coordinates scaled to match the dimensions of Web Mercator.\n2. Reverse-project the result back to WGS84 _as if_ it had been projected with Web Mercator.  So now, when your favorite web mapping library tries to project it into mercator, the geometries end up looking like they were projected using Albers.\n\nThe main catch is that if you actually look at the longitude/latitude\ncoordinates in `output.geojson`, they are totally wrong.  (There are other,\nsubtler catches, too, having to do with Web Mercator's limited latitude range,\nvarying loss of precision, and probably many other nuances I am not aware of.)\n\n## Credits\n\n - Inspired by [this trick](https://www.mapbox.com/blog/mapping-arctic-ice-polar-projection/)\n - All the heavy lifting here is thanks to Mike Bostock's excellent [d3-geo](https://github.com/d3/d3-geo) and [de-geo-projection](https://github.com/d3/d3-geo-projection)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopmentseed%2Fdirty-reprojectors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevelopmentseed%2Fdirty-reprojectors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopmentseed%2Fdirty-reprojectors/lists"}