Re: [osg-users] [forum] [osgEarth] several problems and questions

527 views
Skip to first unread message

Djoé Denne

unread,
Nov 24, 2016, 6:19:45 AM11/24/16
to osg-...@lists.openscenegraph.org
Hi,

First of all, please excuse me for my English.
I'm a beginner in osg and osgEarth (and SIG). I have to make an spatial viewing application with osgEarth, so i have to use osgEarth API.

I load an not georeferenced 3D model and i have the geo information in other file : DATUUM, Projection system, EPSG and an offset in meter for cartographic system and in seconds for geo system. I looking for set those informations programatically. Set the SRS is not a big deal, but I don't know how to set the offset.

I use a osgEarth::Map object with osgEarth::ModelLayer, I set the layer and put it in my map, then i set the SRS of my map :

map->getSRS()->create(".....")

and i create MapNode from my map. How I can set my offset ?

I also have a problem with EarthManipulator::setViewpoint(), it seems to didn't work. even in osgEarth example : osgearth_city, that create boston city and try to set a viewpoint close to boston. in the application, the viewpoint is never set, the view don't move.


Thank you!

Cheers,
Djoé

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

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Bhanu Chandra

unread,
Nov 25, 2016, 5:48:15 AM11/25/16
to osg-...@lists.openscenegraph.org
Hi,
I got "Failed to load terrain engine driver for mp" error when i built osgEarth examples in visual studio 2013

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

Chris Hanson

unread,
Nov 25, 2016, 2:32:43 PM11/25/16
to OpenSceneGraph Users
I load an not georeferenced 3D model and i have the geo information in other file : DATUUM, Projection system, EPSG and an offset in meter for cartographic system and in seconds for geo system. I looking for set those informations programatically. Set the SRS is not a big deal, but I don't know how to set the offset.
I use a osgEarth::Map object with osgEarth::ModelLayer, I set the layer and put it in my map, then i set the SRS of my map :
map->getSRS()->create(".....")

  I think this ais all you need to do:



GeoTransform* xform = new GeoTransform();
...
xform->setTerrain( mapNode->getTerrain() );
...
GeoPoint point(srs, -121.0, 34.0); 
xform->setPosition(point); 


  So, the X and Y coordinates are either the latitude and logitude (if your SRS's system is geographic) or X and Y (usually meters from the system's origin) if it's a projected SRS.

  Does that answer your questions?

  If you have more questions, feel free to email me privately, as I don't always see osgEarth questions on the OSG mailing list.


Cheers,
Djoé

 


--
Chris 'Xenon' Hanson, omo sanza lettere. Xe...@AlphaPixel.com http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Code Forensics • Digital Imaging • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile • iPhone/iPad/iOS • Android
@alphapixel facebook.com/alphapixel (775) 623-PIXL [7495]

Djoé Denne

unread,
Nov 28, 2016, 3:56:28 AM11/28/16
to osg-...@lists.openscenegraph.org
Hi,

Thank you for your answer Chris. In fact, I have something like that :


Code:

foreach(QString modelPath, *modelsPath) {
options.url() = modelPath.toStdString();

// Make the new layer and add it to the map.
ModelLayerOptions layerOptions(modelPath.toStdString()+".10000.scale", options);
ModelLayer *layer = new ModelLayer(layerOptions);

std::cerr << layer->open().message() << std::endl;

map->addModelLayer(layer);
}

SpatialReference* srs = SpatialReference::create("GEOGCS[\"WGS 84\",\n"
" DATUM[\"WGS_1984\",\n"
" SPHEROID[\"WGS 84\",6378137,298.257223563,\n"
" AUTHORITY[\"EPSG\",\"7030\"]],\n"
" AUTHORITY[\"EPSG\",\"6326\"]],\n"
" PRIMEM[\"Greenwich\",0,\n"
" AUTHORITY[\"EPSG\",\"8901\"]],\n"
" UNIT[\"degree\",0.01745329251994328,\n"
" AUTHORITY[\"EPSG\",\"9122\"]],\n"
" AUTHORITY[\"EPSG\",\"4326\"]]");

osgEarth::MapNode* mapNode = new osgEarth::MapNode(map);

GeoTransform* xform = new GeoTransform();

xform->setTerrain( mapNode->getTerrain() );

GeoPoint point(srs, 43.583467, 1.428050 );
xform->setPosition(point);
delete modelsPath;

return mapNode;

this SRS in the geographic system and this coordinate is toulouse coordinate (Conseil général). And nothing appear, but when i try with a earth file, my osgb model appear in right coordinates.

I really don't understand the logic of osgEarth API. Is it really possible to do all we can do with earth file, but programmatically ?

Thank again for your answer.

Djoé.

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=69509#69509

Reply all
Reply to author
Forward
0 new messages