{"id":13610059,"url":"https://github.com/perliedman/reproject","last_synced_at":"2025-04-12T14:18:42.929Z","repository":{"id":57353920,"uuid":"12768119","full_name":"perliedman/reproject","owner":"perliedman","description":"Change, convert, transform, reproject GeoJSON between different projections / CRS","archived":false,"fork":false,"pushed_at":"2022-11-08T20:05:03.000Z","size":252,"stargazers_count":222,"open_issues_count":5,"forks_count":27,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-12T14:18:19.863Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/perliedman.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":"2013-09-11T21:23:20.000Z","updated_at":"2024-10-13T20:59:38.000Z","dependencies_parsed_at":"2022-09-05T11:20:30.037Z","dependency_job_id":null,"html_url":"https://github.com/perliedman/reproject","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Freproject","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Freproject/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Freproject/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Freproject/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perliedman","download_url":"https://codeload.github.com/perliedman/reproject/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248578875,"owners_count":21127714,"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-01T19:01:40.806Z","updated_at":"2025-04-12T14:18:42.903Z","avatar_url":"https://github.com/perliedman.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"reproject [![Build status](https://travis-ci.org/perliedman/reproject.png)](https://travis-ci.org/perliedman/reproject) [![NPM version](https://badge.fury.io/js/reproject.png)](http://badge.fury.io/js/reproject)\n=========\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/perliedman/reproject.svg)](https://greenkeeper.io/)\n\nTransforms GeoJSON from one projection / CRS to another.\n\nAccording to the latest [GeoJSON spec (RFC 7946)](https://tools.ietf.org/html/rfc7946#section-4), GeoJSON coordinates should be assumed to be in WGS84, but sometimes it's useful to use other CRS anyway, and the spec actually leaves some room for this:\n\n\u003e However, where all\n\u003e involved parties have a prior arrangement, alternative coordinate\n\u003e reference systems can be used without risk of data being\n\u003e misinterpreted.\n\nReproject lets you either explicitly specify a GeoJSON's CRS, or use the conventions from the earlier GeoJSON spec: [GeoJSON 2008](http://geojson.org/geojson-spec.html#coordinate-reference-system-objects).\n\n## cli\n\ninstall:\n\n    $ npm install -g reproject\n\nuse:\n\n    $ echo '{\"type\":\"Point\",\"coordinates\":[319180, 6399862]}' | reproject --use-epsg-io --from=EPSG:3006 --to=EPSG:4326\n\nOptions:\n\n* ```--from=crs-name``` is the CRS to convert the GeoJSON from; either a name from `crs-defs`, or a Proj4 CRS definition string\n* ```--to=crs-name``` is the CRS to convert the GeoJSON to; either a name from `crs-defs`, or a Proj4 CRS definition string\n* ```--use-epsg-io``` or ```--eio``` to use [epsg.io](https://epsg.io/) to look up\n  any CRS definitions that aren't already known\n* ```--use-spatialreference``` or ```--sr``` to use [spatialreference.org](http://spatialreference.org/) to look up\n  any CRS definitions that aren't already known\n* ```--crs-defs=file``` to provide a JSON dictionary of known CRS definitions. A sample file of CRS definitions, crs-defs.json, is supplied.\n* ```--reverse``` to reverse the axis (swap x and y) before performing the reprojection\n\nreproject can be used together with for example [wellknown](https://github.com/mapbox/wellknown/) and [geojsonio-cli](https://github.com/mapbox/geojsonio-cli/):\n\n    $ echo \"POINT(319180 6399862)\" | wellknown | reproject --crs-defs=crs-defs.json --from=EPSG:3006 --to=EPSG:4326 | geojsonio\n\n## usage\n\nInstallation is easy with npm:\n\n    npm install reproject\n\nIt works well in the browser with for example [browserify](http://browserify.org/).\n\n## api\n\n### reproject(geojson, from, to, crss)\n\nReprojects the given GeoJSON from the CRS given in **from** to the CRS given in **to**.\n\nThe from and to arguments can either be a proj4 projection object, a string containing a CRS name, or a Proj4 CRS definition string. In\nthe case of a CRS name, the proj4 projection instance is looked up using the **crss** argument. **crss**\nis assumed to be a dictionary of projection names to proj4 objects.\n\nIf from is left undefined or null, the CRS will be detected from the GeoJSON's crs property and looked up in the\n**crss** dictionary.\n\n### toWgs84(geojson, from, crss)\n\nShortcut equivalent to\n\n```js\nreproject(geojson, from, proj4.WGS84, crss)\n```\n\nFor a fully automatic \"convert almost any common projection to lat/lon\", try this:\n\n```js\nvar epsg = require('epsg');\ntoWgs84(geojson, undefined, epsg);\n```\n\n### detectCrs(geojson, crss)\n\nDetects the CRS defined in the given GeoJSON and returns the corresponding proj4 projection instance from\ncrss. If no CRS is defined in the GeoJSON, or the defined CRS isn't present in **crss**, an error is thrown.\n\n### reverse(geojson)\n\nReverses the axis order of the coordinates in the given GeoJSON, such that x becomes y and y becomes x.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperliedman%2Freproject","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperliedman%2Freproject","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperliedman%2Freproject/lists"}