modern parser & stringifier for WKT, EWKT, and GeoJSON

Related tags

Maps geojson wkt
Overview

betterknown

betterknown development is supported by 🌎 placemark.io

I wrote wellknown, a WKT parser and stringifier, eons ago. It's still sort of popular but nobody maintained it after I left Mapbox.

There's wkx, which is stricter and honestly has a better parser, plus supports WKB, but it's also abandoned and has some drawbacks - no TypeScript, somewhat idiosyncratic code, and the bundle size is larger than it needs to be because it brings in browserify shims.

This project aims to be the combination of the two projects. Lightweight like wellknown, strict and correct like wkx, plus with the 2022 energy of supporting TypeScript from day one.

  • 100% TypeScript
  • No dependencies - tiny bundle
  • Parse WKT to GeoJSON, stringify GeoJSON to WKT
  • Optional reprojection of EWKT to GeoJSON's required WGS84 coordinate system

πŸ“• Documentation

Example

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]
});
You might also like...

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.

geotiff.js Read (geospatial) metadata and raw array data from a wide variety of different (Geo)TIFF files types. Features Currently available function

Dec 21, 2022

Serverless raster and vector map tile generation using Mapnik and AWS Lambda

tilegarden πŸ—ΊοΈ 🌻 Contents About Usage Deployment to AWS Additional Configuration Options Required AWS Permissions Features Configuration Selection an

Dec 22, 2022

MERN stack travel app using mapbox API, Travel and drop pin , share reviews and rate the location

MERN stack travel app using mapbox API, Travel and drop pin , share reviews and rate the location

MERN-Travel-Map Travel Map Pin A single page application built with MERN Stack from scratch (MongoDB + Mongoose, Express, React & NodeJs) Table of Con

Dec 29, 2022

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:

CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin. It uses WebGL for hardware-accelerated graphics

Dec 26, 2022

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:

CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin. It uses WebGL for hardware-accelerated graphics

Jan 3, 2023

This is the leaflet plugin for GeoServer. Using this plugin user can have access to wms and wfs request easily.

This is the leaflet plugin for GeoServer. Using this plugin user can have access to wms and wfs request easily.

Documentation leaflet-geoserver-request This is the plugin for Geoserver various kind of requests. Using this plugin, we can make WMS, WFS, getLegendG

Dec 15, 2022

A very fast geospatial point clustering library for browsers and Node.

A very fast geospatial point clustering library for browsers and Node.

supercluster A very fast JavaScript library for geospatial point clustering for browsers and Node. script src="https://unpkg.com/[email protected]/d

Jan 7, 2023

A Node.js map tile library for PostGIS and torque.js, with CartoCSS styling

A Node.js map tile library for PostGIS and torque.js, with CartoCSS styling

Windshaft A Node.js map tile library for PostGIS and torque.js, with CartoCSS styling. Can render arbitrary SQL queries Generates image and UTFGrid in

Dec 22, 2022

The smallest, simplest and fastest JavaScript pixel-level image comparison library

The smallest, simplest and fastest JavaScript pixel-level image comparison library

pixelmatch The smallest, simplest and fastest JavaScript pixel-level image comparison library, originally created to compare screenshots in tests. Fea

Jan 8, 2023
Comments
  • Define handling of SRID

    Define handling of SRID

    GeoJSON as of the IETF draft does not support non-WGS84 coordinates. https://www.rfc-editor.org/rfc/rfc7946#section-4

    So, deal with what to do with SRID.

    My preference:

    • Allow an option for projection method, if given, reproject, otherwise throw.
    opened by tmcw 0
  • Detect and handle heterogenous coordinates

    Detect and handle heterogenous coordinates

    GeoJSON that can exist:

    {
      "type": "LineString",
      "coordinates": [[0, 1, 2], [2, 3]]
    }
    

    Should this be a LINESTRING or LINESTRING Z in WKT? Probably just a LINESTRING. This should be detected and handled explicitly.

    opened by tmcw 0
Releases(v1.0.3)
  • v1.0.3(Aug 24, 2022)

    This is most likely the last release of betterknown before its announcement, so it's basically the "first state" of the module and its best description is simply what's in the README.

    https://github.com/placemark/betterknown/compare/v1.0.2...v1.0.3

    Source code(tar.gz)
    Source code(zip)
Geokit - is a command-line interface (CLI) tool written in javascript, that contains all the basic functionalities for measurements, conversions and operations of geojson files.

Geokit Geokit is a command-line interface (CLI) tool written in javascript, that contains all the basic functionalities for measurements, conversions

Development Seed 31 Nov 17, 2022
Tools for editing Shapefile, GeoJSON, TopoJSON and CSV files

Mapshaper Introduction Mapshaper is software for editing Shapefile, GeoJSON, TopoJSON, CSV and several other data formats, written in JavaScript. Maps

Matthew Bloch 3.2k Jan 2, 2023
Dashboards-maps is a frontend plugin that helps you in uploading custom GeoJSON to OpenSearch and communicates with the geospatial backend plugin for the same.

Welcome! Project Resources Code of Conduct License Copyright Dashboards-Maps Dashboards-maps is a frontend plugin that helps you in uploading custom G

null 9 Dec 28, 2022
Write or parse GeoJSON as YAML

geoyaml Write or parse GeoJSON as YAML. Like this: type: FeatureCollection features: - geometry: type: Point coordinates: - 37.9

Lou Huang 19 Dec 1, 2021
Reproject GeoJSON. Works Offline.

reproject-geojson Reproject GeoJSON features Works Offline Pure JavaScript Cross-Platform (NodeJS or Browser) install npm install reproject-geojson us

Daniel J. Dufour 8 Jul 22, 2022
A memory-efficient GeoJSON representation.

memory-geojson (experimental ?? ) A memory-efficient GeoJSON representation. This is not a new format. It's not meant to be serialized, and it doesn't

Tom MacWright 19 Nov 29, 2022
Polymaps is a free JavaScript library for making dynamic, interactive maps in modern web browsers.

Polymaps Polymaps is a free JavaScript library for making dynamic, interactive maps in modern web browsers. See http://polymaps.org for more details.

Urban Airship 1.6k Dec 23, 2022
A modern study React component of leaflet draw for react-leaflet

React Leaflet Draft A modern study React component of leaflet draw for react-leaflet React component of leaflet-draw for react-leaflet Table of conten

Giovane Santos Silva 16 Oct 20, 2022
An online tool to generate and visualize maps for irregular and/or gapped LED layouts, for use with FastLED, Pixelblaze and other libraries.

An online tool to generate and visualize maps for irregular and/or gapped LED layouts, for use with FastLED, Pixelblaze and other libraries.

Jason Coon 172 Dec 8, 2022
The NASA WorldWind Javascript SDK (WebWW) includes the library and examples for creating geo-browser web applications and for embedding a 3D globe in HTML5 web pages.

Web WorldWind New versions of WorldWind released Web WorldWind 0.10.0 and WorldWind Java 2.2.0 are now available on GitHub. The new version of Web Wor

NASA WorldWind 770 Jan 1, 2023