Quantcast

Floating Points

classic Classic list List threaded Threaded
4 messages Options
Scott Shaw Scott Shaw
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Floating Points

Hello,

I'm trying to place points on the globe with an elevation of 0 and I'm having some trouble.  I'm setting up my Map/MapNode like this:

    //MapOptions mapOptions;

    //mapOptions.profile()->srsString() = "wgs84";
    //mapOptions.profile()->vsrsString() = "egm2008";

    //Map *map = new Map(mapOptions);
    Map *map = new Map();
    map->setCache(Registry::instance()->getDefaultCache());

    GDALOptions gdal;
    gdal.url() = qApp->applicationDirPath().toStdString() +
            "/osgEarthData/world.tif";
    ImageLayer *imageLayer = new ImageLayer("DefaultIL", gdal);
    map->addImageLayer(imageLayer);

    m_mapNode = new MapNode(map);

The commented lines are other things I've tried.  I tried all acceptable vertical datum strings and none seem to work.

I'm figuring out the position of my points like this:
       
        const SpatialReference *srs = m_mapNode->getMapSRS();

        osg::Vec3d positionLongLatEl(destLong, destLat, 0.0);
        osg::Vec3d positionXYZ;

        srs->transformToWorld(positionLongLatEl, positionXYZ);

The points end up way above the surface of the Earth:




I used an elevation of -700 for the red dots and yellow rectangle.  I could do the same for the points, but I'd rather figure out what I'm doing wrong.  I've tried explicitly transforming the Z value with VerticalDatum's msl2hae, but that doesn't work either.  Any ideas?

Thank you,
Scott
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Floating Points

Scott,

It's likely that your terrain is just not tessellated enough to represent a smooth surface at that zoom level.

Try something like

   TerrainOptions t;
   t.minLOD() = 20;

   MapNodeOptions m;
   m.setTerrainOptions(t);

   Map* map = new Map(m);

This will force the terrain to tessellate down to LOD 20 even if the imagery's resolution isn't that high. Hope that helps.
Glenn Waldron / Pelican Mapping
Scott Shaw Scott Shaw
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Floating Points

Glenn,

Thanks for the quick reply!  Still the same issue though.  Messing with the minLOD didn't seem to do anything.

When you say terrain you just mean the sphere that represents the Earth, right?  I don't have any elevation layers in my scene.

This doesn't only show up in my code.  When using the --mem option in osgearth_features, the points are floating as well.

Here's a view of the lines created:


And here is the bottom right corner popping up into the sky:


Thank you,
Scott
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Floating Points

Scott,
Best set would be to post a simple earth file that demonstrates the problem. Thanks.
Glenn Waldron / Pelican Mapping
Loading...