{"id":1028,"date":"2018-08-22T21:14:13","date_gmt":"2018-08-22T19:14:13","guid":{"rendered":"http:\/\/hannes.enjoys.it\/blog\/?p=1028"},"modified":"2018-08-22T21:23:03","modified_gmt":"2018-08-22T19:23:03","slug":"lots-of-citygml-files-to-a-single-obj-to-draco-with-localising-coordinates-to-000","status":"publish","type":"post","link":"https:\/\/hannes.enjoys.it\/blog\/2018\/08\/lots-of-citygml-files-to-a-single-obj-to-draco-with-localising-coordinates-to-000\/","title":{"rendered":"Lots of CityGML files to a single obj to draco with localising coordinates to 0,0,0"},"content":{"rendered":"<p>I used the CityGML LoD2 model of Hamburg here, <a href=\"http:\/\/daten-hamburg.de\/geographie_geologie_geobasisdaten\/3d_stadtmodell_lod2\/LoD2-DE_HH_2017-12-31.zip\">http:\/\/daten-hamburg.de\/geographie_geologie_geobasisdaten\/3d_stadtmodell_lod2\/LoD2-DE_HH_2017-12-31.zip<\/a> from <a href=\"http:\/\/suche.transparenz.hamburg.de\/dataset\/3d-stadtmodell-lod2-de-hamburg3\">http:\/\/suche.transparenz.hamburg.de\/dataset\/3d-stadtmodell-lod2-de-hamburg3<\/a>. (If you do this for Hamburg, you might want to not include Neuwerk&#8217;s tiles ;))<\/p>\n<p>1. <a href=\"https:\/\/github.com\/tudelft3d\/CityGML2OBJs\/\">https:\/\/github.com\/tudelft3d\/CityGML2OBJs\/<\/a><\/p>\n<p><code>python2 CityGML2OBJs.py -i LoD2-DE_HH_2017-12-31.zip\/ -o LoD2-DE_HH_2017-12-31.zip_obj\/<\/code><\/p>\n<p>converts each CityGML file to a obj (takes about half an hour on my system).<\/p>\n<p>2. <a href=\"http:\/\/gfx.cs.princeton.edu\/proj\/trimesh2\/\">http:\/\/gfx.cs.princeton.edu\/proj\/trimesh2\/<\/a><\/p>\n<p><code>mesh_cat LoD2-DE_HH_2017-12-31.zip_obj\/*.obj -o LoD2-DE_HH_2017-12-31.zip.obj<\/code><\/p>\n<p>turns them into one single obj.<\/p>\n<p><code>mesh_filter LoD2-DE_HH_2017-12-31.zip.obj -center -scale 0.001 -rot 90 -1 0 0 LoD2-DE_HH_2017-12-31.zip_localised.obj<\/code><\/p>\n<p>translates &#8220;so center of mass is at (0,0,0)&#8221; and scales to something smaller and rotates so that z is up. trimesh2&#8217;s documentation on the rot parameter is insufficient, I think my solution means &#8220;rotate by 90 degrees -1 times around x, 0 times around y, 0 times around z&#8221; or something like that. <a href=\"https:\/\/github.com\/jrock08\/Trimesh2\/blob\/master\/util\/mesh_filter.cc#L323\">Look into the source<\/a> if that helps you.<\/p>\n<p>3. <a href=\"https:\/\/google.github.io\/draco\/\">https:\/\/google.github.io\/draco\/<\/a><\/p>\n<p><code>draco_encoder -i LoD2-DE_HH_2017-12-31.zip_localised.obj -o LoD2-DE_HH_2017-12-31.zip_localised.obj.drc<\/code><\/p>\n<p>makes it tiny (8 Megabyte).<\/p>\n<p>I did not do any error checking, used a epsilon of 1 in CityGML2OBJs and just wanted to play around.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I used the CityGML LoD2 model of Hamburg here, http:\/\/daten-hamburg.de\/geographie_geologie_geobasisdaten\/3d_stadtmodell_lod2\/LoD2-DE_HH_2017-12-31.zip from http:\/\/suche.transparenz.hamburg.de\/dataset\/3d-stadtmodell-lod2-de-hamburg3. (If you do this for Hamburg, you might want to not include Neuwerk&#8217;s tiles ;)) 1. https:\/\/github.com\/tudelft3d\/CityGML2OBJs\/ python2 CityGML2OBJs.py -i LoD2-DE_HH_2017-12-31.zip\/ -o LoD2-DE_HH_2017-12-31.zip_obj\/ converts each CityGML file to a obj (takes about half an hour on my system). 2. http:\/\/gfx.cs.princeton.edu\/proj\/trimesh2\/ mesh_cat LoD2-DE_HH_2017-12-31.zip_obj\/*.obj -o [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,27,12,10],"tags":[],"class_list":["post-1028","post","type-post","status-publish","format-standard","hentry","category-commandline","category-hamburg","category-linux","category-open-data"],"_links":{"self":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1028","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/comments?post=1028"}],"version-history":[{"count":7,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1028\/revisions"}],"predecessor-version":[{"id":1036,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1028\/revisions\/1036"}],"wp:attachment":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/media?parent=1028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/categories?post=1028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/tags?post=1028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}