Closed dikyridhlo closed 1 month ago
No, not directly, because the 3DCityDB Exporter can only export so-called "top-level features" like Building, Road etc. as visualization objects that are clickable. But you can do a "hack" and use one (or maybe a few) SQL statement(s) and copy the tuples from the ROOM table into the table GENERIC_CITYOBJECT. Since GenericCityObjects are "top-level features" you can then export them as clickable objects using the KML/COLLADA/glTF exporter. If the attributes assigned to the rooms are generic attributes, you can also use the Spreadsheet Exporter to export them from the GenericCityObjects. When you export the rooms as GenericCityObjects, you should choose a slightly transparent coloring in the visualization export preferences.
thank you for answer my question. @thomashkolbe
But you can do a "hack" and use one (or maybe a few) SQL statement(s) and copy the tuples from the ROOM table into the table GENERIC_CITYOBJECT.
is it mean i copy ROOM table to GENERIC_CITYOBJECT or use custom query when export process ?
but the GENERIC_CITYOBJECT and ROOM have different structure column (building_id , lod4_multi_surface , lod4_solid_id) , can i pass the different structure to the GENERIC_CITYOBJECT ?
I think you just need one SQL insert-statement like:
insert into GENERIC_CITYOBJECT (id, objectclass_id, class, function, usage, lod4_brep_id) as select id, 5, class, function, usage, lod4_solid_id from ROOM;
You should check the documentation about the correct attribute names of both tables. I don't have the time to check or test this. See https://3dcitydb-docs.readthedocs.io/en/latest/3dcitydb/schema/generics.html and https://3dcitydb-docs.readthedocs.io/en/latest/3dcitydb/schema/building.html
The statement above assumes that the Room geometries in your CityGML file are given as lod4Solids. If they are instead given as lod4MultiSurfaces you'll need to change lod4_solid_id from ROOM
to lod4_multi_surface_id from ROOM
You will need to use psql or pgAdmin to connect to your database in order to execute such an SQL statement (assuming that you are using PostGIS).
After the export you should delete these tuples again from the GENERIC_CITYOBJECT table.
you can then export them as clickable objects using the KML/COLLADA/glTF exporter.
when using Vis-Export , am i use SELECT objectclass_id from GENERIC_CITYOBJECT
for select only from GENERIC_CITYOBJECT or i just export it without SQL filter?
because after i tuples from room to generic_cityobject i just got this info message No Top Level Feature. detail info message in picture below
You can export without SQL filter, if you do not have any other GenericCityObjects in your dataset. Just export the GenericCityObjects in LOD4.
I forgot to add that after the SQL statement you will also need to do a commit;
statement. Otherwise your updates to the database are only visible within the current psql or pgAdmin session. Only after a commit the inserted tuples will be accessible and visible to other processes like the visualization exporter.
You can export without SQL filter, if you do not have any other GenericCityObjects in your dataset. Just export the GenericCityObjects in LOD4.
I forgot to add that after the SQL statement you will also need to do a
commit;
statement. Otherwise your updates to the database are only visible within the current psql or pgAdmin session. Only after a commit the inserted tuples will be accessible and visible to other processes like the visualization exporter.
i already use commit after SQL Statement. but still got info message No Top Level Feature when Vis-Export.
is any possibility this issue from my GML file ?
This simple hack will only work, if the room geometries in your CityGML file are attached as properties directly with the Room features (as lod4Solid or lod4MultiSurface). Is this the case with your dataset?
If the Room features do not have geometries, but only thematic surfaces like "FloorSurface", "CeilingSurface" and the geometries are associated only with them, you will need to collect all the individual surfaces which are related to each room (stored in the table THEMATIC_SURFACE) and create a new MultiSurface within the SURFACE_GEOMETRY table. But this is quite more tricky than just one SQL statement.
There is one more thing to consider: You have to add an additional entry in the cityobject
table for each generic city object to make this workaround work. The reason is that the exporter first searches the cityobject
table to find the top-level city objects to be exported.
This should be the sequence of steps to perform:
room
table to get the IDs of your room objects.cityobject
using the ID value from step 1. Create a new tuple in cityobject
by copying the values from the room tuple (use insert into ... as select from
). Be careful to not copy the ID value but create a new one using the cityobject_seq
sequence. And do not copy the OBJECTCLASS_ID value but use 5
instead.generic_cityobject
and copy the values from the room
table as shown in the post from @thomashkolbe. Use the ID value just created from the sequence, and again use 5
for the OBJECTCLASS_ID.I'm pretty sure you can do this with one SQL statement if the geometry is stored with the room objects in the room
table as outlined by @thomashkolbe.
thanks @thomashkolbe and @clausnagel . i will check my GML first. if geometries attributes is exist i will try the SQL Statement again.
Thanks, @clausnagel, you are right; I forgot about the missing tuple in the CITYOBJECT
table.
I mean, we are talking here about a "hack", and you could possibly simplify this by setting the OBJECTCLASS_ID
of the tuples representing the rooms to 5
. Then the exporter would recognize them as GenericCityObjects. This could be done with such a statement:
insert into GENERIC_CITYOBJECT (id, objectclass_id, class, function, usage, lod4_brep_id) as
select id, 5, class, function, usage, lod4_solid_id from ROOM;
update CITYOBJECT set objectclass_id=5 where objectclass_id=41;
commit;
After these changes, you probably can no longer export the Buildings correctly. One possibility is to reverse the update statement above after the visualization export of the GenericCityObjects by reassigning 41
to the OBJECTCLASS_ID
of those city objects, whose ID values are included in the set of ID values of the ROOM table.
OF COURSE, DO NOT PERFORM SUCH EXPERIMENTS ON A PRODUCTION DATABASE, BECAUSE IT MAY / WILL CORRUPT YOUR DATABASE!
hi @thomashkolbe and @clausnagel i can show my room now. but i have another problem , my building have four floor but after i do your hack , only show first floor. it's possibilty on my GML or another possibilty ? thank you
Please check your GML file, if more than one room is included and that their geometries are represented as a direct property (lod4Solid
or lod4MultiSurface
) of the BuildingRoom
objects. The hack only works, if the geometries of all rooms are represented by lod4Solid
properties. If some rooms use lod4MultiSurface
instead, then you would need to modify the insert statement and add another insert statement dealing with those rooms that use lod4MultiSurface
. For visual inspection of CityGML datasets I recommend to use the free software FZKViewer https://www.iai.kit.edu/english/1302.php.
BTW, are you sure that your visualization only shows one room? When you move the mouse pointer along the vertical extent of the building, maybe different rooms on different storeys will be highlighted then. I recommend to render the rooms using a semi-transparent color, this way you can see, if maybe more rooms are hidden in the model.
BTW, are you sure that your visualization only shows one room? When you move the mouse pointer along the vertical extent of the building, maybe different rooms on different storeys will be highlighted then. I recommend to render the rooms using a semi-transparent color, this way you can see, if maybe more rooms are hidden in the model.
not only one room but only first floor (which have 12 room).
I recommend to use the free software FZKViewer
i already using FME and FZKViewer before import to 3dcitydb. and the result each room can be clicked for all floors.
Can't say more without looking at the GML file. Could you provide it?
can i know your e-mail address ?
You'll find it here: https://www.asg.ed.tum.de/en/gis/our-team/staff/prof-thomas-h-kolbe/
already send to your email , thanks @thomashkolbe
Well, while the file is syntactically correct (it validates against the CityGML schema), it seems to have a number of problems. While I can visualize the model in FME, I can't using the FZKViewer nor the CityDoctor software. In FZKViewer the room geometries are not shown, which it normally does. CityDoctor issues a long list of problems including self-intersecting polygons, duplicate points in a number of LinearRings. I can't go further, because it is not clear what is causing the problem.
Please check, if the presented hack above works with this open dataset: http://www.citygmlwiki.org/index.php?title=File:FZK-Haus-LoD4-KIT-IAI-KHH-B36-V1.gml If it works, the problem is most likely related to your dataset.
Also, try to identify and remove the errors from your dataset using the freely downloadable CityDoctor: https://www.citydoctor.eu/en/citydoctor_main.html
hello thomas and clausnagel, i am on same team project with @dikyridhlo we try new file for test. we have check the gml file on fkzviewer and citydoctor, and no error appear. this building have 10 room. but when i open with web-map-viewer, only 3 room can be clicked. GML file attached on bottom of my post.
this is the sample gml i use sample_gml.zip
hi @clausnagel and @thomashkolbe could you answer my team question, please?
Hi @dikyridhlo, the file has some issues, for example are the doors and windows not included in the building object. They are also in the wrong namespace (brid:). But this should not cause a problem with the rooms. However, you will have to look for the problem for yourself by inspecting the table data.
BTW, did you try the file I named before? Did it work? If yes, then inspect the contents of the involved tables (after having applied the hack) using pgAdmin and compare in which way the table contents look different from the contents when you have imported your model and have applied the hack then. You will need to look at every tuple in the tables and comprehend the way how CityGML data is being mapped onto the diverse tables as explained in the documentation (this is what I would do if it was my project).
I try your file @thomashkolbe and only 5 tiles / rooms can be clicked (mark on the red checklist), it is true?
Hi @dikyridhlo, the file has some issues, for example are the doors and windows not included in the building object. They are also in the wrong namespace (brid:). But this should not cause a problem with the rooms. However, you will have to look for the problem for yourself by inspecting the table data.
let me check my GML file for a while.
When you create a visualization export, only export the GenericCityObjects and not also the Buildings at the same time. You will have to configure the visualization exporter in such a way that it does not automatically pulls down the 3D objects to the ground (Altitude mode "absolute" in the "Elevation" submenu in the "VIS Export" menu). Otherwise all rooms on the higher levels will all be pulled to base height zero as shown in your figure above (because each room is considered to be a separate GenericCityObject).
You should do the Building model export in a second exporter run (without the GenericCityObjects). This way you can also define two layers in the 3D webmap client, and users can switch off the outer Building structure and then see the interior rooms.
I want to create 3D visualization for room, not the building. So, I can click on a room and show its attribute.
Is it possible?