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
geojson2obj with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
There's a small command line example in the
examples directory, which you can use to try out the library.
Sample command line:
cd examples ./cli.js norway-coastline.geo.json
It should write an OBJ file to your stdout.
geojson to an OBJ, that is written to the
When done, the callback is called;
callback is a normal Node.js callback
accepting an error as the first argument.
Note that the
geojson must be a
f(feature, callback)that returns the height of a feature's base; by default, a function that always returns 0.
f(feature, callback)that returns the height of a feature; by default, a function that returns 10 for polygons and 0.3 for linestrings.
lineWidth: for line geometries, returns the width of the generated geometry; defaults to 2.
featureName: a function
f(feature, callback)that returns the OBJ group name used for a feature; by default a function that numbers the features
featureMaterial: a function
f(feature, callback)that returns the name of the material for a feature; if undefined, the material is not changed for this feature; see
f(coordinate)that returns the OBJ vertex point (X and Z) for a GeoJSON coordinate, needed to convert from GeoJSON's WGS84 coordinates to a cartesian coordinate; see the
mtlliba string or array of paths that will be added as material libraries to the resulting OBJ