add shp file failed because of unknown reason

classic Classic list List threaded Threaded
5 messages Options
S.W S.W
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

add shp file failed because of unknown reason

i tried to add world.shp from data file in osg. i believe that my code is right but it didn't work as it should be. i can add it from earth file successfully by the way,  so i don't think that i miss any dll. please help me,i've been working on it for two days.
here are my codes.

osgEarth::Drivers::OGRFeatureOptions featureOpt;
featureOpt.url() = "D://OSG//data//data//world.shp";
featureOpt.buildSpatialIndex() = true;

osgErath::Symbology::Style style;
osgEarth::Symbology::LineSymbol* ls = new osgEarth::Symbology::LineSymbol;
ls->stroke()->color() = osg::Vec4f(1,0,0,1);
ls->stroke()->width() = 1.5f;
style.addSymbol(ls);

osgErath::Drivers::FeatureGeomModelOptions theFeatureModel;
theFeatureModel.styles() = new StyleSheet();
theFeatureModel.style()->addStyle(style);
theFeatureModel.featureOptions() = featureOpt;

mapNode->getMap()->addModelLayer(new ModelLayer("boundries",theFeatureModel));
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: add shp file failed because of unknown reason

S.W,
Did not work...how? Any details? Also, I would remove the double-slashes from your path name.
Glenn Waldron / Pelican Mapping
S.W S.W
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: add shp file failed because of unknown reason

glenn,
i took some picture here.
i use order osgviewer feature_country_boundaries.earth, and it works well as follows:


and cmd suggests:


i can also use the earth file in my own project:


but when i try to add the world.shp by codes, it didn't show up,and i've followed your advice to replace '//' by using '\':

S.W S.W
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: add shp file failed because of unknown reason

In reply to this post by gwaldron
the pictures are too small, i'd like to repost them.




S.W S.W
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: add shp file failed because of unknown reason

In reply to this post by gwaldron
gleen,sorry to bother you,but i still don't know why.
so i took some picture here.i wish i could send you a vedio if it's necessary.
i can use feature_country_boundries.earth (which is an example earth file in oe2.8) both in cmd and my project.


 

but when i try to use world.shp by codes as an ModelLayer(because i might need to remove it or reload it later in my own project, and there's no way to achieve it by using earth file directly ) , and i've followd your oppinion to change "//" to "\" ,but it still doesn't show up.


can there be any chance that the reason that it doesn't show up is all because of my NearFarRatio?
please write back to me,thanks a lot.


------------------ Original ------------------
From:  "gwaldron [via osgEarth]";<[hidden email]>;
Date:  Tue, Jun 27, 2017 01:09 AM
To:  "霍乱"<[hidden email]>;
Subject:  Re: add shp file failed because of unknown reason

S.W,
Did not work...how? Any details? Also, I would remove the double-slashes from your path name.
Glenn Waldron / Pelican Mapping



If you reply to this email, your message will be added to the discussion below:
http://forum.osgearth.org/add-shp-file-failed-because-of-unknown-reason-tp7591017p7591022.html
To unsubscribe from add shp file failed because of unknown reason, click here.
NAML
Loading...