OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

[osgEarth] several problems and questions


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General [forum]
View previous topic :: View next topic  
Author Message
hulrien
Newbie


Joined: 24 Nov 2016
Posts: 2

PostPosted: Thu Nov 24, 2016 10:42 am    Post subject:
[osgEarth] several problems and questions
Reply with quote

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é

EDIT :

Finally, i use something like that :

Code:

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

    GeoTransform* xform = new GeoTransform();

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

    GeoPoint point(srs, 0.0, 0.0);
    xform->setPosition(point);


with map is my osgEarth::Map with my osgEarth::ModelLayer. But it's didn't work to.what I'm doing wrong ?
Back to top
View user's profile Send private message
bhanu406
Newbie


Joined: 18 Nov 2016
Posts: 14

PostPosted: Fri Nov 25, 2016 9:23 am    Post subject:
Re: [osgEarth] several problems and questions
Reply with quote

Hi,
I got "Failed to load terrain engine driver for mp" error when i built osgEarth examples in visual studio 2013
Back to top
View user's profile Send private message
Chris Hanson
Guest





PostPosted: Fri Nov 25, 2016 7:32 pm    Post subject:
[osgEarth] several problems and questions
Reply with quote

Quote:
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:


http://docs.osgearth.org/en/latest/faq.html#common-usage




Quote:
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.




Quote:
Cheers,
Djoé

 



--
Chris 'Xenon' Hanson, omo sanza lettere. 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]

------------------
Post generated by Mail2Forum
Back to top
hulrien
Newbie


Joined: 24 Nov 2016
Posts: 2

PostPosted: Mon Nov 28, 2016 8:56 am    Post subject:
Re: [osgEarth] several problems and questions
Reply with quote

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 is 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é.

EDIT :

I solved my problem by passing by annotation. I consider my model like an annotation (it's make sense). so I can use something like :

Code:
Config conf;

    std::string json = "{\n"
            "   \"model\" : {\n"
            "      \"driver\" : \"simple\",\n"
            "      \"name\" : \"toulouse\",\n"
            "      \"position\" : {\n"
            "         \"hat\" : \"29.5\",\n"
            "         \"lat\" : \"43.61320\",\n"
            "         \"long\" : \"1.434500\"\n"
            "      },\n"
            "      \"url\" : \"path-to-osgb.osgb\"\n"
            "   }\n"
            "}";

    conf.fromJSON(json);

    osgEarth::MapNode* mapNode = osgEarth::MapNode::findMapNode(node);

    osg::Group* modelGroup = new osg::Group();

    osgEarth::Annotation::AnnotationRegistry::instance()->create(mapNode, conf, 0L, modelGroup);
   
    return modelGroup;



Maybe it can be helpful for others.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General [forum] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Forum problems SMesserschmidt General 2 Wed Apr 12, 2017 7:24 am View latest post
No new posts osgEarth Latha Rani General [forum] 3 Thu Apr 06, 2017 2:13 pm View latest post
No new posts About the parameter _lock_azim_while_... Michelle_Xie General 1 Thu Mar 02, 2017 2:08 am View latest post
No new posts problems getting shadow demo to work Lee Butler General 1 Mon Feb 20, 2017 4:02 am View latest post
No new posts How to merge osgocean and osgearth Rambabu General 2 Wed Dec 07, 2016 12:43 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP