Discussion:
osgEarth processing problems
ting zhang
2010-08-11 02:25:14 UTC
Permalink
Hi,

I write a map.earth file according to the original examples of .earth files in osgEarth project. The map.earth file is as follows:

<map name="tkm" type="projected">
<heightfield name="terrain-dem" driver="vpb">
<url> C:\Test.ive </url>
</heightfield>
</map>

where “Test.ive” file is generated by VPB0.9.10 and it’s a terrain file using Gaussian projected coordinate system.. Therefore, the type in .earth file is "projected".
Then in my win32 console program, I read the map.earth in my project, the codes are as follows:

// header files …
……
int _tmain(int argc, _TCHAR* argv[])
{
int num =1;
char* path = "D:/maps.earth";
osg::ArgumentParser arguments(&num,&path);
osgViewer::Viewer viewer(arguments);
osg::ref_ptr<osg::Node> Test_node = osgDB::readNodeFile(“D:/maps.earth”);
viewer.setSceneData(Test_node.get());
viewer.realize();
std::cout<<path<<std::endl;
viewer.run();
return 0;
}

The compilation is correct. When debugging the code, I find the Test_node point is not empty. However, the ive terrain file is not shown in the whole scene. In the whole scene, there is nothing but the blue background. I use cow.osg to replace Test.ive for tests. However, I cannot find the cow, either.
I wonder what is going on with my osgEarth, are there some problems with my coordinate setting or something else? Plus, all the osgEarth dll libraries have been put in the environmental path. Thank you.


Thank you!

Cheers,
ting

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=30683#30683
Ulrich Hertlein
2010-08-11 02:41:24 UTC
Permalink
Hi,
Post by ting zhang
I write a map.earth file according to the original examples of .earth files in
<map name="tkm" type="projected">
<heightfield name="terrain-dem" driver="vpb">
<url> C:\Test.ive </url>
</heightfield>
</map>
...
The compilation is correct. When debugging the code, I find the Test_node point is not
empty. However, the ive terrain file is not shown in the whole scene. In the whole scene,
there is nothing but the blue background. I use cow.osg to replace Test.ive for tests.
However, I cannot find the cow, either.
This is just a wild guess, but is it possible that the 'Test.ive' file isn't loaded in the
first place?

Have you tried removing the spaces around the path in the <url> tag? It seems to be using
it's own XML parsing (*sigh*) so maybe it's failing on those (or rather not stripping
leading/trailing spaces from the text node)?

Cheers,
/ulrich
Ulrich Hertlein
2010-08-11 02:45:13 UTC
Permalink
Post by Ulrich Hertlein
it's own XML parsing (*sigh*) so maybe it's failing on those (or rather not stripping
Apologies, it's using expat.
/ulrich
Glenn Waldron
2010-08-11 03:22:35 UTC
Permalink
Ting,
I'm not sure what a "Gaussian projected coordinate system" is.. can you
elaborate?

To use the VPB driver, you have to specify several additional options so
that osgEarth knows how to load the model. Look at the docs here:
http://www.osgearth.org/wiki/TileSourcePluginVPB and look at the
vpb_earth_bayarea.earth sample.

I also suggest you set the environment variable OSGEARTH_NOTIFY_LEVEL=INFO
and see if the output gives you any clues.


Glenn Waldron : Pelican Mapping : +1.703.652.4791
Post by ting zhang
Hi,
I write a map.earth file according to the original examples of .earth files
<map name="tkm" type="projected">
<heightfield name="terrain-dem" driver="vpb">
<url> C:\Test.ive </url>
</heightfield>
</map>
where “Test.ive” file is generated by VPB0.9.10 and it’s a terrain file
using Gaussian projected coordinate system.. Therefore, the type in .earth
file is "projected".
Then in my win32 console program, I read the map.earth in my project, the
// header files …
……
int _tmain(int argc, _TCHAR* argv[])
{
int num =1;
char* path = "D:/maps.earth";
osg::ArgumentParser arguments(&num,&path);
osgViewer::Viewer viewer(arguments);
osg::ref_ptr<osg::Node> Test_node =
osgDB::readNodeFile(“D:/maps.earth”);
viewer.setSceneData(Test_node.get());
viewer.realize();
std::cout<<path<<std::endl;
viewer.run();
return 0;
}
The compilation is correct. When debugging the code, I find the Test_node
point is not empty. However, the ive terrain file is not shown in the whole
scene. In the whole scene, there is nothing but the blue background. I use
cow.osg to replace Test.ive for tests. However, I cannot find the cow,
either.
I wonder what is going on with my osgEarth, are there some problems with my
coordinate setting or something else? Plus, all the osgEarth dll libraries
have been put in the environmental path. Thank you.
Thank you!
Cheers,
ting
------------------
http://forum.openscenegraph.org/viewtopic.php?p=30683#30683
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
ting zhang
2010-08-11 22:35:15 UTC
Permalink
Hi,

Waldron, and Hertlein, thank you so much.
"Gaussian projected coordinate system" means when I generate the terrain, I use like parameters --cs "+proj=tmerc +lat_0=0 +lon_0=117 +k=1 +x_0=500000 +y_0=0 +ellps=krass +units=m +no_defs" and "-e 659690 3529390 5835 4525 "in commandline, so the terrain is generated using the WGS84 globe and Gaussian coordinate.
I studied the vpb_earth_bayarea.earth file which has the link of http://www.openscenegraph.org/data/earth_bayarea/earth.ive. I directly download the earth.ive and locate it in my hard disk. Then I rewrite the vpb_earth_bayarea.earth, which is as follows:
<!--
osgEarth Sample

This example pulls imagery and dems from an online VirtualPlanetBuilder generated database.
-->

<map name="Virtual Planet Builder model" type="geocentric">

<image name="imagery layer 0" driver="vpb">
<url>e:\earth.ive</url>
<primary_split_level>5</primary_split_level>
<secondary_split_level>11</secondary_split_level>
</image>

<heightfield name="dem" driver="vpb">
<url>e:\earth.ive</url>
</heightfield>

<!--
<cache>
<path>cache</path>
</cache>
-->
</map>
i.e. I only replace the link http://www.openscenegraph.org/data/earth_bayarea/earth.ive in vpb_earth_bayarea.earth with “e:\earth.ive” in the new .earth file. I open the new .earth file using osgviewer, but there is still nothing but the blue background in the scene (Fig.1 ). When I quit the program, the cmd window is shown in Fig. 2 and Fig.3 . What is going on with my program, would you give me some suggestions, thank you.


Thank you!

Cheers,
ting

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




Attachments:
Loading Image...
Loading Image...
Loading Image...
ting zhang
2010-08-11 22:41:27 UTC
Permalink
Hi,
I noticed that there are such parameters in the above .earth file
primary_split_level>5</primary_split_level>
<secondary_split_level>11</secondary_split_level>
Does it mean that the first LOD level and second LOD level are respectively 5 and 11? If it is true, I am not sure if the earth.ive fits the request.


Thank you!

Cheers,
ting

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=30701#30701
ting zhang
2010-08-12 02:04:41 UTC
Permalink
Hi,

I changed my .earth file again. Here it is:
<heightfield name="dem" driver="vpb">
<url>e:\earth.ive</url>
</heightfield>
Then I use osgviewer to view this .earth file. However, the texture on this ive file disappear, as shown in fig.1.
(The original image directly viewed by osgviewer (without using .earth file) is shown in fig. 2)
Could any one tell me what is going on with my codes so that the texture is gone?

Thank you!

Cheers,
ting

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




Attachments:
Loading Image...
Loading Image...
Glenn Waldron
2010-08-12 12:57:03 UTC
Permalink
ting,

I am a little confused. Did you get your earth.ive working? Is that it in
the first screenshot? I had some comments but I want to verify exactly where
you are with this now.

As for the missing texture, that is becuase you need both an <image> and a
<heightfield> definition if you want both the texture and dem in a vpb file.
Refer to the example on the wiki page.


Glenn Waldron : Pelican Mapping : +1.703.652.4791
Post by ting zhang
Hi,
<heightfield name="dem" driver="vpb">
<url>e:\earth.ive</url>
</heightfield>
Then I use osgviewer to view this .earth file. However, the texture on this
ive file disappear, as shown in fig.1.
(The original image directly viewed by osgviewer (without using .earth
file) is shown in fig. 2)
Could any one tell me what is going on with my codes so that the texture is gone?
Thank you!
Cheers,
ting
------------------
http://forum.openscenegraph.org/viewtopic.php?p=30703#30703
http://forum.openscenegraph.org//files/fig2_106.jpg
http://forum.openscenegraph.org//files/fig1_111.jpg
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
ting zhang
2010-08-12 14:15:55 UTC
Permalink
Hi,Waldron

You are right. The earth.ive actually didn't work in the program. I changed the earth.ive into cow.osg or glider.osg in my .earth file, they both appear as a globe without texture like fig.1. , which proved that the model in the .earth is not loaded successfully.
Then would you help me to analyze what is going on with my program.

Thank you!

Cheers,
ting

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=30715#30715
Jason Beverage
2010-08-12 14:38:06 UTC
Permalink
Hi Ting,

It doesn't make sense to change your model to cow.osg or glider.osg in
the Earth file, it only works on VPB databases. One thing you need to
make sure of is that the VPB database you've generated was generated
with the --terrain option. The osgEarth VPB driver only works on
databases generated with the --terrain option, not the old style
polygonal databases that VPB can generate as well.

Thanks,

Jason
Post by ting zhang
Hi,Waldron
You are right. The earth.ive actually didn't work in the program. I changed the earth.ive into cow.osg or glider.osg in my .earth file, they both appear as a globe without texture like fig.1. , which proved that the model in the .earth is not loaded successfully.
Then would you help me to analyze what is going on with my program.
Thank you!
Cheers,
ting
------------------
http://forum.openscenegraph.org/viewtopic.php?p=30715#30715
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Glenn Waldron
2010-08-12 14:45:27 UTC
Permalink
ting,
Please post the latest version of your .earth file in its entirety so we
have a good starting point. Thanks.

Glenn Waldron : Pelican Mapping : +1.703.652.4791
Post by ting zhang
Hi,Waldron
You are right. The earth.ive actually didn't work in the program. I changed
the earth.ive into cow.osg or glider.osg in my .earth file, they both appear
as a globe without texture like fig.1. , which proved that the model in the
.earth is not loaded successfully.
Then would you help me to analyze what is going on with my program.
Thank you!
Cheers,
ting
------------------
http://forum.openscenegraph.org/viewtopic.php?p=30715#30715
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
ting zhang
2010-08-15 08:38:55 UTC
Permalink
Hi,

Today I tried again. Here is the detail:

I generated a ive file using the Boston tif materials and VPB. The VPB parameter command line is:
-t boston-10m-utm19n-meters.tif -d boston-dem-downtown-5m-utm19n-meters.tif --TERRAIN -l 4 -v 3 -o Boston.ive
Note: I used–TERRAIN in my command line for using the vpb driver of osgEarth.
The generated terrain is shown in Fig. 1 and Fig. 2.
Then I viewed the ive file using .earth file (modified by vpb_earth_bayarea.earth; Boston.ive and its related subtiles are located in my D partition of hard disk ). The ive file is as follows:
<!--
osgEarth Sample
This example pulls imagery and dems from an online VirtualPlanetBuilder generated database.
-->
<map name="Virtual Planet Builder model" type="geocentric">
<image name="imagery layer 0" driver="vpb">
<url>d:\Boston.ive</url>
<primary_split_level>5</primary_split_level>
<secondary_split_level>11</secondary_split_level>
</image>
<heightfield name="dem" driver="vpb">
<url>d:\Boston.ive</url>
</heightfield>
<!--
<cache>
<path>cache</path>
</cache>
-->
</map>
Then I view the .earth file using osgviewer, but nothing is in the scene (in Fig.3 ). Could anyone tell me what is the problem? Thank you.



Thank you!

Cheers,
ting

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




Attachments:
Loading Image...
Loading Image...
Loading Image...
Glenn Waldron
2010-08-22 16:19:50 UTC
Permalink
Ting,

Your Boston.ive terrain is in a projected coordinate system (UTM). Your
.earth file is set to create a geocentric map (round-earth). These are not
compatible. You need to pick one or the other. If you pick projected, you
will also need to tell osgEarth what the profile is for the data. You can do
this by including a <profile> tag (see:
http://osgearth.org/wiki/MapElementProfile).

Or course, you could skip the VPB creation altogether and simply load the
Boston TIFFs directly into osgEarth using the GDAL driver (see:
http://osgearth.org/wiki/TileSourcePluginGDAL).

Glenn
Post by ting zhang
Hi,
I generated a ive file using the Boston tif materials and VPB. The VPB
-t boston-10m-utm19n-meters.tif -d boston-dem-downtown-5m-utm19n-meters.tif
--TERRAIN -l 4 -v 3 -o Boston.ive
Note: I used–TERRAIN in my command line for using the vpb driver of
osgEarth.
The generated terrain is shown in Fig. 1 and Fig. 2.
Then I viewed the ive file using .earth file (modified by
vpb_earth_bayarea.earth; Boston.ive and its related subtiles are located in
<!--
osgEarth Sample
This example pulls imagery and dems from an online VirtualPlanetBuilder generated database.
-->
<map name="Virtual Planet Builder model" type="geocentric">
<image name="imagery layer 0" driver="vpb">
<url>d:\Boston.ive</url>
<primary_split_level>5</primary_split_level>
<secondary_split_level>11</secondary_split_level>
</image>
<heightfield name="dem" driver="vpb">
<url>d:\Boston.ive</url>
</heightfield>
<!--
<cache>
<path>cache</path>
</cache>
-->
</map>
Then I view the .earth file using osgviewer, but nothing is in the scene
(in Fig.3 ). Could anyone tell me what is the problem? Thank you.
Thank you!
Cheers,
ting
------------------
http://forum.openscenegraph.org/viewtopic.php?p=30745#30745
http://forum.openscenegraph.org//files/nothing_174.jpg
http://forum.openscenegraph.org//files/boston_terrain_212.jpg
http://forum.openscenegraph.org//files/boston_255.jpg
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Loading...