Discussion:
[forum] Anyone knows how to load CityGML files in OSG?
Fan ZHANG
2012-09-12 12:31:43 UTC
Permalink
Hi,

There is a plugin libcitygml that supports citygml files read operation in OSG.
And I can use osgviewer to see citygml files.
Now I want to load citygml files with codes.
Should it be added as Node or something?
Actually I tried with the osgDB::readNodeFile....
Failed....
So please anyone knows the right way?


Thank you!

Cheers,
Fan :D

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49980#49980
Tassilo Glander
2012-09-12 12:38:25 UTC
Permalink
Hi Fan,

not sure what you mean with "load citygml files with codes". You want to access the citygml semantics and attributes in addition to just see the graphical model? Then you have to take a look at the reader in libcitygml to see how it stores the citygml nodes and maybe write your own.

Cheers,
Tassilo

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49981#49981
Fan ZHANG
2012-09-12 12:54:08 UTC
Permalink
Thanks so much for your fast reply~
I mean to start to deal with citygml files, not just 'see' the graphical model on the screen with osgviewer. So I just want to ask how to load citygml files and make it display on the screen using C++ codes of my own? I know this is sort of simple and stupid question....I just tried several times and failed, so I posted it here...
Post by Tassilo Glander
Hi Fan,
not sure what you mean with "load citygml files with codes". You want to access the citygml semantics and attributes in addition to just see the graphical model? Then you have to take a look at the reader in libcitygml to see how it stores the citygml nodes and maybe write your own.
Cheers,
Tassilo
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49983#49983
Tassilo Glander
2012-09-12 13:01:19 UTC
Permalink
Hi Fan,

can you post a code snippet of what you tried? And some details about how it failed? Because it should work with the readNodeFIle method, for example like this:

osg::Node* n = osgDB::readNodeFile("pathToCityGMLFile");
osgViewer::Viewer viewer;

// add model to viewer.
viewer.setSceneData( n);

return viewer.run();

This is independent from the data you try to load (CityGML, 3ds, obj, ...), as long as a plugin exists it will be loaded.

Cheers,
Tassilo

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49984#49984
Tassilo Glander
2012-09-12 13:15:58 UTC
Permalink
Hi Fan,

I do not see something wrong in this moment. I would try a few things:
* Do you get commandline output while loading? (libcitygml usually puts out something text while loading)
* You could check that something is loaded with a debugger to check what is returned or add some code to see if a node is returned.
* You could try to load another model that is known to work, like the cow.osg model
* Do you have only one osg on your machine? Might be that when you try osgviewer you actually use another version...

Cheers,
Tassilo[/list]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49986#49986
Fan ZHANG
2012-09-12 13:19:27 UTC
Permalink
Okay thanks so much for your suggestions.
I will try to fix this up and leave a feedback here if problem solved.

Thanks again.
Post by Tassilo Glander
Hi Fan,
* Do you get commandline output while loading? (libcitygml usually puts out something text while loading)
* You could check that something is loaded with a debugger to check what is returned or add some code to see if a node is returned.
* You could try to load another model that is known to work, like the cow.osg model
* Do you have only one osg on your machine? Might be that when you try osgviewer you actually use another version...
Cheers,
Tassilo[/list]
:D :D

------------------------
ohhhhhhhhhhhhhh newbie to OSG......................

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49987#49987
Fan ZHANG
2012-09-12 13:43:14 UTC
Permalink
ohhhhh what a shame....
Simply needs to remove '/root' at the beginning of the file path....
Now it works...

tks~
Post by Tassilo Glander
Hi Fan,
* Do you get commandline output while loading? (libcitygml usually puts out something text while loading)
* You could check that something is loaded with a debugger to check what is returned or add some code to see if a node is returned.
* You could try to load another model that is known to work, like the cow.osg model
* Do you have only one osg on your machine? Might be that when you try osgviewer you actually use another version...
Cheers,
Tassilo[/list]
------------------------
ohhhhhhhhhhhhhh newbie to OSG......................

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49988#49988

Loading...