Skip to main content

WKTCRSWriter 🚧



Writes WKT-CRS (Well-known text representation of coordinate reference systems).


npm install
npm install


If you need to write WKT, or in other words, convert JSON back to WKT, use the unparse function. You basically call unparse on JSON data that is in the same layout as returned by parse. Numbers will be stringified by your JavaScript engine before being written and anything after raw: will be written directly into the output without quotes.

import { encode } from '';
import { WKTCRSWriter } from '';

encode(WKTWriter, [
"NAD27 / UTM zone 16N",
"Clarke 1866",
["AUTHORITY", "EPSG", "7008"]
["AUTHORITY", "EPSG", "6267"]
["PRIMEM", "Greenwich", 0, ["AUTHORITY", "EPSG", "8901"]],
["UNIT", "degree", "raw:0.0174532925199433", ["AUTHORITY", "EPSG", "9122"] ],
["AUTHORITY", "EPSG", "4267"]
["PROJECTION", "Transverse_Mercator"],
["PARAMETER", "latitude_of_origin", 0],
["PARAMETER", "central_meridian", -87],
["PARAMETER", "scale_factor", 0.9996],
["PARAMETER", "false_easting", 500000],
["PARAMETER", "false_northing", 0],
["UNIT", "metre", 1, ["AUTHORITY", "EPSG", "9001"]],
["AXIS", "Easting", "raw:EAST"],
["AXIS", "Northing", "raw:NORTH"],
["AUTHORITY", "EPSG", "26716"]
// returns
{ data: `PROJCS["NAD27 / UTM zone 16N",GEOGCS["NAD27",DATUM["North_American_Datum_1927",SPHEROID["Clarke 1866",6378206.4,294.9786982139006,AUTHORITY["EPSG","7008"]],AUTHORITY["EPSG","6267"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4267"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-87],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","26716"]]` }


The WKTCRSLoader is based on a fork of under Creative Commons CC0 1.0 license.