Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
wkt-parser-helper
Advanced tools
Readme
Convert and parse between Well-Known-Text (WKT) and GeoJSON
Using npm npm i wkt-parser-helper
Using yarn yarn add wkt-parser-helper
In CommonJS env
const { parseFromWK } = require('wkt-parser-helper');
const geojson = parseFromWK(
'POLYGON ((-3.706512451171875 40.420074462890625, -3.70513916015625 40.420074462890625, -3.70513916015625 40.42144775390625, -3.706512451171875 40.42144775390625, -3.706512451171875 40.420074462890625))'
);
// geojson is a Polygon Geometry
Using imports
import { convertToWK } from 'wkt-parser-helper';
const myFeature: Feature = {
type: 'Feature',
properties: {},
geometry: {
type: 'Polygon',
coordinates: [
[
[-3.706512451171875, 40.420074462890625],
[-3.70513916015625, 40.420074462890625],
[-3.70513916015625, 40.42144775390625],
[-3.706512451171875, 40.42144775390625],
[-3.706512451171875, 40.420074462890625],
],
],
},
};
const myFeatureAsWKT = convertToWK(myFeature);
// myFeatureAsWKT is 'POLYGON ((-3.706512451171875 40.420074462890625, -3.70513916015625 40.420074462890625, -3.70513916015625 40.42144775390625, -3.706512451171875 40.42144775390625, -3.706512451171875 40.420074462890625))'
From v4.0.0 onwards, support for converting GeoJSON to WKB is dropped.
▸ convertFeatureCollection(featureCollection
: FeatureCollection): string
Converts a GeoJSON FeatureCollection to WKT GeometryCollection
export
Name | Type | Description |
---|---|---|
featureCollection | FeatureCollection | The FeatureCollection to convert to WKT |
Returns: string
The GeoJSON converted to well known representation
Defined in: index.ts:34
▸ convertFeatureToWK(geojson
: Feature): string
Converts GeoJSON Feature to WKT
export
Name | Type | Description |
---|---|---|
geojson | Feature | Feature object to convert |
Returns: string
The GeoJSON converted to well known text representation
Defined in: index.ts:24
▸ convertGeometryToWK(geojson
: Geometry): string
Converts GeoJSON Geometry to WKT
export
Name | Type | Description |
---|---|---|
geojson | Geometry | Geometry object to convert |
Returns: string
The GeoJSON converted to well known text representation
Defined in: index.ts:13
▸ convertToWK(geojson
: GeoJSON): string
Shorthand to convert GeoJSON Features, Geometries or FeatureCollections to WKT or WKB
export
Name | Type | Description |
---|---|---|
geojson | GeoJSON | The GeoJSON to convert |
Returns: string
The GeoJSON as WKT
Defined in: index.ts:51
▸ parseFromWK(item
: string, asFeature?
: boolean, properties?
: GeoJsonProperties): Feature | Geometry
Parse a WKT or WKB into a GeoJSON Feature or Geometry
export
Name | Type | Default value | Description |
---|---|---|---|
item | string | - | The WKT to convert to GeoJSON |
asFeature | boolean | false | - |
properties | GeoJsonProperties | - | - |
Returns: Feature | Geometry
The WKT as GeoJSON
Defined in: index.ts:71
FAQs
Module to help parse GeoJSONs to WKT and back
The npm package wkt-parser-helper receives a total of 1,777 weekly downloads. As such, wkt-parser-helper popularity was classified as popular.
We found that wkt-parser-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.