https://github.com/russbiggs/geojson2stl
Convert GeoJSON to ASCII STL
https://github.com/russbiggs/geojson2stl
3d-printing geojson stl stl-files
Last synced: 5 months ago
JSON representation
Convert GeoJSON to ASCII STL
- Host: GitHub
- URL: https://github.com/russbiggs/geojson2stl
- Owner: russbiggs
- License: isc
- Created: 2018-03-18T19:59:33.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-01T02:06:17.000Z (about 7 years ago)
- Last Synced: 2024-11-06T09:48:47.710Z (6 months ago)
- Topics: 3d-printing, geojson, stl, stl-files
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Convert GeoJSON to ASCII STL
### Installation
```sh
npm install geojson2stl
```### In the terminal
```sh
geojson2stl example.geojson
```#### Flags
-o
--outputSets the output file path and file name
_Default_: ./output.stl
-e
--extrudeSets the millimeters to extrude the shape
_Default_: 1
-s
--sizeSet 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
```js
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](https://tools.ietf.org/html/rfc7946)) and projects all coordinates to mercator.