Skip to content

Commit

Permalink
feat: added function to create wkt collections to maintain properties
Browse files Browse the repository at this point in the history
  • Loading branch information
alrico88 committed Aug 21, 2024
1 parent f4854dc commit 3ee4f84
Show file tree
Hide file tree
Showing 5 changed files with 616 additions and 485 deletions.
36 changes: 27 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ From v4.0.0 onwards, support for converting GeoJSON to WKB is dropped.
- [convertFeatureCollection](#convertfeaturecollection)
- [convertFeatureToWK](#convertfeaturetowk)
- [convertGeometryToWK](#convertgeometrytowk)
- [convertGeoJSONFeatureCollectionToWktCollection](#convertGeoJSONFeatureCollectionToWktCollection)
- [convertToWK](#converttowk)
- [parseFromWK](#parsefromwk)

Expand All @@ -83,8 +84,6 @@ Converts a GeoJSON FeatureCollection to WKT GeometryCollection

The GeoJSON converted to well known representation

Defined in: [index.ts:34](https://github.com/alrico88/wkt-parser-helper/blob/master/src/index.ts#L34)

---

### convertFeatureToWK
Expand All @@ -105,8 +104,6 @@ Converts GeoJSON Feature to WKT

The GeoJSON converted to well known text representation

Defined in: [index.ts:24](https://github.com/alrico88/wkt-parser-helper/blob/master/src/index.ts#L24)

---

### convertGeometryToWK
Expand All @@ -127,7 +124,32 @@ Converts GeoJSON Geometry to WKT

The GeoJSON converted to well known text representation

Defined in: [index.ts:13](https://github.com/alrico88/wkt-parser-helper/blob/master/src/index.ts#L13)
---

### convertGeoJSONFeatureCollectionToWktCollection

**convertGeoJSONFeatureCollectionToWktCollection**<P\>(`geojson`: _FeatureCollection_<Geometry, P\>): P & { `wkt`: _string_ }[]

Converts a GeoJSON FeatureCollection into an array of objects where each object
contains a WKT (Well-Known Text) string representing the geometry and the properties
from the original GeoJSON feature

#### Type parameters:

| Name | Description |
| :--- | :--------------------------------------------- |
| `P` | The type of properties in the GeoJSON features |

#### Parameters:

| Name | Type | Description |
| :-------- | :-------------------------------- | :-------------------------------------------- |
| `geojson` | _FeatureCollection_<Geometry, P\> | The GeoJSON FeatureCollection to be converted |

**Returns:** P & { `wkt`: _string_ }[]

)[]} An array of objects where each object contains a `wkt` string
representing the geometry and all the properties from the original GeoJSON feature

---

Expand All @@ -149,8 +171,6 @@ Shorthand to convert GeoJSON Features, Geometries or FeatureCollections to WKT o

The GeoJSON as WKT

Defined in: [index.ts:51](https://github.com/alrico88/wkt-parser-helper/blob/master/src/index.ts#L51)

---

### parseFromWK
Expand All @@ -172,5 +192,3 @@ Parse a WKT or WKB into a GeoJSON Feature or Geometry
**Returns:** Feature \| Geometry

The WKT as GeoJSON

Defined in: [index.ts:71](https://github.com/alrico88/wkt-parser-helper/blob/master/src/index.ts#L71)
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"eslint-config-airbnb-typescript": "^14.0.1",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.25.1",
"tslib": "^2.6.3",
"tsup": "^6.2.1",
"typedoc": "^0.20.30",
"typedoc-plugin-markdown": "^3.6.0",
Expand Down
Loading

0 comments on commit 3ee4f84

Please sign in to comment.