1.1.6 • Published 9 months ago

gtran-shapefile v1.1.6

Weekly downloads
28
License
MIT
Repository
github
Last release
9 months ago

gtran-shapefile

NPM Version Build Status

convert geojson to shapefile and backwards

Installation

npm install gtran-shapefile

Functions

  • setPromiseLib(object)

    Specify the promise library. If not, the library will use the native Promise.

  • fromGeoJson(geojson, fileName, options)

    Save the geojson into the given file name.

    Options:

    • esriWKT: ESRI WTK string that specifies the shapefile's spatial reference and generates .prj file. It could be found at SpatialReference.org.
  • toGeoJson(fileName)

    Read the given file and convert it into geojson.

Use Example

var shp = require('gtran-shapefile');

// if specific promise library is needed
shp.setPromiseLib(require('bluebird'));

// Read shapefile
shp.toGeoJson('source.shp')
.then(function(object) {
    var geojson = object;
});

// Save geojson into shapefile
shp.fromGeoJson(geojson, 'point.shp', {
  // ESRI WKT string of WGS84
  esriWKT: 'GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]'
})
.then(function(fileNames) {
    console.log('files have been saved at:' + fileNames);
});
1.1.6

9 months ago

1.1.5

9 months ago

1.1.4

5 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago