I am using this reproject tool to convert a GeoJSON point from EPSG:3857 to EPSG:4326.
My command fails. What am I doing wrong?
$ echo '{"type":"Point","coordinates":[-13720479.997764934,5688254.733325758]}' | reproject --from=EPSG:3857 --to=EPSG:4326
/usr/local/lib/node_modules/reproject/cli.js:98
throw new Error("Could not find definition for CRS \"" + crsName + "\".");
^
Error: Could not find definition for CRS "EPSG:3857".
at lookupCrs (/usr/local/lib/node_modules/reproject/cli.js:98:10)
at Object. (/usr/local/lib/node_modules/reproject/cli.js:25:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
Answer
If you use the --use-spatialreference
or --sr
the command will look up the missing projection from spatialreference.org and yours can't be found because the contents of the default crs-defs.json doesn't have a reference for it.
There are only entries for EPSG:2400,3006 and 4326. You can add any you need to that list or make your own json file and reference that using --crs-defs=/some/path/file.json
It looks like you could add the following proj definition:
$>gdalsrsinfo -o proj4 EPSG:3857
'+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'
No comments:
Post a Comment