Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created August 24, 2022 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/19ce9832980fc21567369dfa000151b9 to your computer and use it in GitHub Desktop.
Save tmcw/19ce9832980fc21567369dfa000151b9 to your computer and use it in GitHub Desktop.
import { wktToGeoJSON, geoJSONToWkt } from "betterknown";
import proj4 from "proj4";
// Converting & reprojecting an EWKT string
wktToGeoJSON(`SRID=3857;POINT(-400004.3 60000.1)`, {
proj: proj4,
});
// Converting GeoJSON to WKT
geoJSONToWkt({
type: 'Point',
coordinates: [1, 2]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment