polygon-city / citygml-to-obj

Takes a CityGML file and creates an OBJ file for each building
MIT License
18 stars 4 forks source link

uncaught error: undefined normal #8

Closed meetar closed 9 years ago

meetar commented 9 years ago
/cityGML/node_modules/citygml-to-obj/node_modules/citygml-validate-shell/index.js:489
      var absNormalZ = Math.abs(normal.e(3));
                                      ^
TypeError: Cannot read property 'e' of undefined
    at /cityGML/node_modules/citygml-to-obj/node_modules/citygml-validate-shell/index.js:489:39
    at /cityGML/node_modules/citygml-to-obj/node_modules/lodash/index.js:3073:15
    at baseForOwn (/cityGML/node_modules/citygml-to-obj/node_modules/lodash/index.js:2046:14)
    at /cityGML/node_modules/citygml-to-obj/node_modules/lodash/index.js:3043:18
    at Function.<anonymous> (/cityGML/node_modules/citygml-to-obj/node_modules/lodash/index.js:3346:13)
    at /cityGML/node_modules/citygml-to-obj/node_modules/citygml-validate-shell/index.js:460:7
    at /cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:683:13
    at iterate (/cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:260:13)
    at process._tickCallback (node.js:355:11)
meetar commented 9 years ago

So i threw a check for undefined normals in there:

  if (typeof(normal) === "undefined") {
    callback(new Error("Error: normal undefined"));
    return;
  }

...and it gets further every time I run it, but now it will eventually hit a string of apparent async errors which freezes up the conversion, which typically looks like this:

Elevation values not present in API response
Unable to convert building: BLDG_0003000f0024a2e4
Elevation values not present in API response
Unable to convert building: BLDG_00030009007e1032
Elevation values not present in API response
Unable to convert building: BLDG_0003000f0024a2c3
Elevation values not present in API response
Unable to convert building: BLDG_0003000f004332da
Unable to convert building: BLDG_0003000e0057a49d
Unable to convert building: DEB_LOD2_UUID_834e0abc-05e2-4c70-8869-b22678ee4daa
/cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:43
            if (fn === null) throw new Error("Callback was already called.");
                                   ^
Error: Callback was already called.
    at /cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:43:36
    at /cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:688:17
    at /cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:167:37
    at /cityGML/node_modules/citygml-to-obj/node_modules/citygml-validate-shell/index.js:634:5
    at /cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:683:13
    at iterate (/cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:260:13)
    at process._tickCallback (node.js:355:11)
Elevation values not present in API response
Elevation values not present in API response
Error: normal undefined
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: channel closed
    at ChildProcess.target.send (child_process.js:414:26)
    at /cityGML/node_modules/citygml-to-obj/index.js:79:22
    at /cityGML/node_modules/citygml-to-obj/node_modules/lodash/index.js:3073:15
    at baseForOwn (/cityGML/node_modules/citygml-to-obj/node_modules/lodash/index.js:2046:14)
    at /cityGML/node_modules/citygml-to-obj/node_modules/lodash/index.js:3043:18
    at Function.<anonymous> (/cityGML/node_modules/citygml-to-obj/node_modules/lodash/index.js:3346:13)
    at processWorkers (/cityGML/node_modules/citygml-to-obj/index.js:70:5)
    at updateQueue (/cityGML/node_modules/citygml-to-obj/index.js:65:3)
    at wrapper [as _onTimeout] (timers.js:274:14)
    at Timer.listOnTimeout (timers.js:119:15)
peter@cube ~/work/citygml $ Unable to convert building: DEB_LOD2_UUID_bb6cf007-59e9-4be2-9b3a-eaab481de009
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: channel closed
    at process.target.send (child_process.js:414:26)
    at /cityGML/node_modules/citygml-to-obj/worker.js:34:13
    at /cityGML/node_modules/citygml-to-obj/worker.js:289:7
    at /cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:52:16
    at /cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:661:30
    at /cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:167:37
    at /cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:1160:30
    at Request._callback (/cityGML/node_modules/citygml-to-obj/worker.js:259:9)
    at Request.self.callback (/cityGML/node_modules/citygml-to-obj/node_modules/request/request.js:197:22)
    at Request.emit (events.js:110:17)
Saved: output/BLDG_0003000e00796615.obj
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: channel closed
    at process.target.send (child_process.js:414:26)
    at /cityGML/node_modules/citygml-to-obj/worker.js:34:13
    at /cityGML/node_modules/citygml-to-obj/worker.js:284:7
    at /cityGML/node_modules/citygml-to-obj/worker.js:307:5
    at /cityGML/node_modules/citygml-to-obj/node_modules/fs-extra/node_modules/graceful-fs/graceful-fs.js:102:5
    at FSReqWrap.oncomplete (evalmachine.<anonymous>:95:15)
meetar commented 9 years ago

another example:

Building has already been converted: output/BLDG_0003000e0064e495.obj
Building has already been converted: output/BLDG_0003000e0061407c.obj
Unable to convert building: BLDG_00030002007d1a88
/cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:43
            if (fn === null) throw new Error("Callback was already called.");
                                   ^
Error: Callback was already called.
    at /cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:43:36
    at /cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:688:17
    at /cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:167:37
    at /cityGML/node_modules/citygml-to-obj/node_modules/citygml-validate-shell/index.js:546:9
    at /cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:683:13
    at iterate (/cityGML/node_modules/citygml-to-obj/node_modules/async/lib/async.js:260:13)
    at process._tickCallback (node.js:355:11)
Error: normal undefined
Building has already been converted: output/DEB_LOD2_UUID_e0f1363c-c7f5-40cf-bb11-3229fc0c8e9d.obj
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: channel closed
    at ChildProcess.target.send (child_process.js:414:26)
    at /cityGML/node_modules/citygml-to-obj/index.js:79:22
    at /cityGML/node_modules/citygml-to-obj/node_modules/lodash/index.js:3073:15
    at baseForOwn (/cityGML/node_modules/citygml-to-obj/node_modules/lodash/index.js:2046:14)
    at /cityGML/node_modules/citygml-to-obj/node_modules/lodash/index.js:3043:18
    at Function.<anonymous> (/cityGML/node_modules/citygml-to-obj/node_modules/lodash/index.js:3346:13)
    at processWorkers (/cityGML/node_modules/citygml-to-obj/index.js:70:5)
    at updateQueue (/cityGML/node_modules/citygml-to-obj/index.js:65:3)
    at wrapper [as _onTimeout] (timers.js:274:14)
    at Timer.listOnTimeout (timers.js:119:15)

This one actually exited the script, rather than just hanging. I'm over 6000 buildings converted now, though!

robhawkes commented 9 years ago

Crazy errors! I'll dig into this and see what I can find. Something pretty serious must be happening for the normals not to be found – perhaps a funky mesh or some edge-case with the elevation logic. It should be fairly easy to find out if it always happens to the same building or not.

Update: I'm able to hit these errors myself so I'll dig into them and see what's going on

robhawkes commented 9 years ago

I've pushed an update to citygml-validate-shell to add in a check for valid normals (0.1.24). It's worth re-installing citygml-to-obj so it pulls in that update and seeing how the errors change. It should output the building ID as part of an Unable to convert building message if there's a problem. We can use that to track down the cause using the visual debugging tool I created (just list the problematic IDs here for now).

I'm unsure why you're seeing channel closed errors (as if the workers have shut down) and callback already called errors. Let me know if you see them with the shell validation update as I'm not seeing them myself (I can process the entire Mitte.gml with no crashes or normal errors now – takes 20 mins).

As for why we're seeing errors about the normals, preliminary research suggests that it was an error on my part with not properly handling polygons that fail the collinear check. There are potentially some edge-cases where buildings can have polygons with either too few points or with rare shapes (eg. a perfect circle or a triangle) and maybe somehow these fail the collinear tests.

meetar commented 9 years ago

no longer seeing problems :+1: