Giter Club home page Giter Club logo

shp2stl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shp2stl's Issues

Final STL file empty and strange output

I heard about this node package from your excellent blog post. I haven't, however, been able to replicate your approach with my own shapefile. My code and shapefile is over at:

https://github.com/amoeba/3dmaps

The output I get it this:

$ node convert.js
bounds: Infinity Infinity -Infinity -Infinity (spherical)
pre-quantization: 111.195km (1.00°) 111.195km (1.00°)
topology: 0 arcs, 0 points
topojson done
simplification: effective minimum area 0.00
simplification: retained 0 / 0 points (NaN%)
making top planes
making side planes
making bottom planes
done making 3D planes

And the resulting STL file only contains:

solid
endsolid

Is it because of my strange projection? Something else? I've poked around your source to the best of my ability but I can't seem to figure out where I'm messing up.

Getting base height from z values

Hi @dougmccune

Thanks for the great library. I was wondering about submitting a pull request with some additional functionality so I thought I'd get some feedback.

I have a buildings dataset which contains

  • z values in the spatial data for the ground elevation of a building,
  • an attribute for the height of the building

Using shp2stl currently I can use the attribute for the height using the extrudeBy option which works great. However there is nothing that allows me to utilise the z value for ground elevation. So I was wondering if we could introduce a new option called getBaseHeightFromZ. The other option might be to only support a single base height per building which could be derived from an attributed similar to how extrudeBy works.

I've looked upstream and there are a few tweaks that would be required in the shapefile library to support getting z vales into geojson. The topojson conversion part works ok in retaining z values.

Are that any pitfalls that you could see in such an approach? I'm happy to submit a pull request if you're interested.

Regards,
Rowan

Cannot convert: node_modules/three/three.js:32605 for ( i = 0, il = triangles.length; i < il; i ++ ) {

Hello, I am trying to use your library on this dataset. I have the following script:

var fs = require('fs');
var shp2stl = require('shp2stl');
var file = '3D_domy.shp';
shp2stl.shp2stl(file,
    {
        width: 100,
        height: 10,
        extraBaseHeight: 0,
        extrudeBy: "REL_H",
        simplification: .8,
        binary: true,
        cutoutHoles: false,
        verbose: true,
        extrusionMode: 'straight'
    },
    function(err, stl) {
        fs.writeFileSync('brno.stl',  stl);
    }
);

However, it fails with the output:

bounds: -610515.495 -1169601.422 -588998.562 -1150146.302 (cartesian)
pre-quantization: 0.00021516933215169295 0.00019455120194551316
topology: 1704953 arcs, 3409907 points
topojson done
simplification: effective minimum area 0.00194
simplification: retained 3409907 / 3409907 points (100%)
making top planes
Duplicate point 75.87834675878348:45.606545977206764
Duplicate point 47.88109447881095:67.99900334326045
Duplicate point 47.72163847721639:68.22115425580363
Duplicate point 47.57133847571339:68.3893004726506
making side planes
making bottom planes
<pwdpath>/node_modules/three/three.js:32605
		for ( i = 0, il = triangles.length; i < il; i ++ ) {
		                            ^

TypeError: Cannot read property 'length' of null
    at Object.triangulateShape (<pwdpath>/node_modules/three/three.js:32605:31)
    at THREE.ShapeGeometry.addShape (<pwdpath>/node_modules/three/three.js:35513:32)
    at THREE.ShapeGeometry.addShapeList (<pwdpath>/node_modules/three/three.js:35458:8)
    at new THREE.ShapeGeometry (<pwdpath>/node_modules/three/three.js:35442:7)
    at THREE.Shape.makeGeometry (<pwdpath>/node_modules/three/three.js:32162:17)
    at <pwdpath>/node_modules/shp2stl/src/topojson2threejs.js:377:33
    at Array.forEach (<anonymous>)
    at topojson2threeJSBottomPlanes (<pwdpath>/node_modules/shp2stl/src/topojson2threejs.js:374:13)
    at topojson2threejs (<pwdpath>/node_modules/shp2stl/src/topojson2threejs.js:76:16)
    at topojson2stl (<pwdpath>/node_modules/shp2stl/src/shp2stl.js:77:21)

What could be the reason for that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.