geojson2stl

0.2.0 • Public • Published

Convert GeoJSON to ASCII STL

Installation

npm install geojson2stl

In the terminal

geojson2stl example.geojson

Flags

-o --output

Sets the output file path and file name

Default: ./output.stl

-e --extrude

Sets the millimeters to extrude the shape

Default: 1

-s --size

Set the maximum dimension (in x or y dimensions) of the output shape in millimeters

Default:200

example

geojson2stl -s 150 -e 10 -o ./example.stl example.geojson

returns a 150mm maximum dimension, 10mm extrude file named example.stl

in Node

const geojson2stl = require('geojson2stl');
const fs = require('fs');
 
fs.readFile('./myFeatures.geojson', 'utf-8', (err,data) => {
    let options = {};
    options.size = 150; //150mm maximum width or height
    options.extrude = 5; //extrude 5mm in z axis
    let stl = geojson2stl(data, options);
    ...
    ...
});

Reference

geojson2stl(geojson[, options]]) <>

Takes a required parameter of geojson and returns ASCII STL text of the input geojson. Options is an opject with the following optional attributes:

  • output - filename to give name attribute in STL file default: 'output.stl'
  • extrude - a number indicating millimeters to extrude the shape default: 1
  • size - a number indicating the maximum dimension of the output shape default: 200

Caveats

expects geojson as WGS84 (as per the specification) and projects all coordinates to mercator.

Readme

Keywords

Package Sidebar

Install

npm i geojson2stl

Weekly Downloads

1

Version

0.2.0

License

ISC

Unpacked Size

12.9 kB

Total Files

8

Last publish

Collaborators

  • russbiggs