[osg-users] Shapefiles & Coordinate System Conversions

Greg Myers aftacer at gmail.com
Thu Jul 24 21:30:10 PDT 2008


Thanks for the tips Robert.  I'll give them a shot.

-----Original Message-----
From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Robert
Osfield
Sent: Thursday, July 24, 2008 10:03 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Shapefiles & Coordinate System Conversions

Hi Greg,

It sounds like you are on track.

At tip for geospatial data  - With the .shp plugin in SVN head, and
2.5.x dev series the plugin supports loaded the geometry as doubles
rather than the default of floats.  You can enable this by using the
ReaderWriter::Options object passed in with your readNodeFile call, on
this options object you set the options string via
options->setOptionString("double");

Loading the vertex data as double helps with precision tremendously,
but for rendering it totally kills performance as the graphics hard
can't handle doubles, so the OpenGL driver has to convert to floats on
each time you render the vertex data, so load the data, project into
the appropriate coordinates system, then place with a local orign with
a MatrixTransform above it to place it in its original place, and then
convert the vertex data to floats.  This way you can maintain a good
balance between precision and performance.

Robert.

On Thu, Jul 24, 2008 at 3:19 PM, Greg Myers <aftacer at gmail.com> wrote:
> Hello all,
>
>
>
> I am brand new to OSG and I am still wading through all the information
and
> examples learning as much as I can.  I am working on my latest exercise in
> which I am overylaying a shapefile onto a terrain database that I have.
The
> shapefile consists of bodies of water (lakes) in California.  I created
the
> terrain database using osgdem and some DTED data that I have for a small
> portion of California.  I know that the shapefile consists of lat, lon,
> height data ( thanks to osgconv ) and I wanted to convert those data to
> x,y,z coordinates in the coordinate system of the terrain.  I did this by
> using a node visitor for the shapefile node after reading it in with
> readNodeFile.  I accessed the ArrayData via the Geode instance and then
> looped through the data using the ellipsoid model from the terrain's
> coordinate system to convert the lat,long,height data.  Then all I had to
do
> was the overlay stuff and add it to the root node.
>
>
>
> Anyway, what I really want to know is if there is a better solution for
> converting the lat,long,height data or am I on track?
>
>
>
> Any existing examples or code snippets would be much appreciated.
>
>
>
> Thanks,
>
> Greg
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




More information about the osg-users mailing list