Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including gdalmultitosingle with all npm packages installed. Try it out:

var gdalmultitosingle = require("gdalmultitosingle")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

gdalmultitosingle v1.0.1

Transform multi part geometries to single part geometries.

gdalMultiToSingle

Transform multi-part geometries to single part geometries.

Dependencies

Setup

npm install gdalmultitosingle

Usage

const gdalMultiToSingle = require('gdalmultitosingle')

const outputPath = gdalMultiToSingle.processData(<inputFeatures>, <outputName>, <outputFormat>);
// Returns the output filepath.

Sample Usage

const gdalMultiToSingle = require('gdalmultitosingle');
const gdal = require('gdal');

const getFeatures = dataset => gdal.open(dataset).layers.get(0);

const inputLayer = getFeatures('path/to/inputData.geojson');

const singleParts = gdalMultiToSingle.processData(inputLayer, 'path/to/outputData.shp', 'ESRI Shapefile');

Allowed Outputs

Tested with the most common outputs that are listed on gdal. Message me on GitHub if you need some help or find some bug.

You can also use vsimem to save the data temporary on the memory. So the command would be something like:

const singleParts = gdalMultiToSingle.processData(inputLayer, '/vsimem/temp_output.shp', 'ESRI Shapefile')

=^]

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free