Get unlimited public & private packages + team-based management with npm Teams.Learn more »

transform-to-geojson

1.1.0 • Public • Published

transform-to-geojson

Transforms WKT/WKB/Google Maps Encoded polygons /Google Maps Polygons to GeoJSON

Current Supported Formats

Google Maps Encoded Polygons

Can be an string:

path: '!}!&qA8272ja@*&...'

or an object:

{
  "id": "40232",
  "path": "!}!&qA8272ja@*&..."
}

Google Maps Polygons

Can handle an array of coordinates:

coordinates: [[-85.75584,38.22601], [-85.70709,38.22594], [-85.67413,38.17522]]

or a polygon object with lat and long values:

{
  "id" : 0,
  "editable" : false,
  "path" : [
    {
      "lat" : 34.176708515026,
      "lng" : -118.874130249023
    },
    {
      "lat" : 34.1756256284364,
      "lng" : -118.873980045319
    },
    {
      "lat" : 34.1755191142507,
      "lng" : -118.876512050629
    },
    {
      "lat" : 34.1770990608781,
      "lng" : -118.877241611481
    },
    {
      "lat" : 34.1781286730964,
      "lng" : -118.874344825745
    }
  ]
}

WKB

Can either be an object with WKB data:

{
  "_id" : "WtTYF7Aa7Qb3i6cpr",
  "wkb" : "AQMAAAAB..."
}

or a minimal array of WKB data:

wkbs: ['aaaa', 'bbbb', 'cccc', ...]

WKT

Can currently handle a minimal array input with WKT data:

wkts: ['MULTIPOLYGON(1 2 3 4 ...)', 'MULTIPOLYGON(23 4 2 32...)']

Install

npm i transform-to-geojson

DownloadsWeekly Downloads

6

Version

1.1.0

License

MIT

Last publish

Collaborators

  • avatar