Alan,

 

THANKS!  I am able to transform from a CADARG tile to an OSG image now.
Together with the georeferencing data coming from GDAL, I should be set.

 

Thanks for all the pointers.

 

Michael

 

________________________________

From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Alan
Ott
Sent: Friday, May 01, 2009 6:15 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Simple moving map using CADRG data

 

Michael,

I'm actually not loading the TOC file at all. My map operates on a
directory full of tiles. What's convenient about this is that sometimes
I don't have a TOC file at all (for example, sometimes I just have a
bunch of GeoTIFFs).

I don't actually read the image data myself. I let the OSG plugin do
that work for me. I just read the header of each tile using GDAL (to get
the georeferencing information), then close the GDAL dataset, then read
the image data from the tile using the normal OSG method
(osgDB::readImageFile()). Right here, you might want to use an
osgDB::ImageOptions and set the pixel window up to control the maximum
resolution you want to load. Some CADRG images can get very large.

Keep in mind though, that you'll have to tell osgDB::Registry that files
with the file extension of the file you're trying to read (tl1, ja1,
etc.) should be read by the OSG GDAL Plugin by calling:
    osgDB::Registry::addFileExtensionAlias
<http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs
/a00595.html#0f72e649a69082e9d357ef7b5b3e4455>
("YOUR_FILE_EXTENSION_HERE", "gdal") .

So to answer your question, I never even get a subdataset, because I
don't use the TOC file.

Alan.

Day, Michael (Mike) (CIV) wrote: 

Alan,
 
The georeferencing part makes sense, thanks for pointing that out.
 
 
When you load from GDAL are you doing something more sophisticated than
this?
 

  poDataset = (GDALDataset*) GDALOpen("path\\RPF\\A.TOC", GA_ReadOnly);

  for each subdataset (tile):

    nextSubDataset = (GDALDataset*) GDALOpen("path", GA_ReadOnly);

 

    for each tile in nextSubDataset: //is this necessary??!

      extract pixel information      //It's pretty involved... going 

                                     //through RasterBands and

                                     //Blocks, etc.

 

The reason I is because it seems like you're saying that once you get to
a subdataset then the OSG plugin might be able to extract the tile to an
image for you?  This would save a lot of pain.

 

If it's not possible, do you have any sample code showing how to extract
a tile into an image?

 
Thanks,
 
Michael Day
 
---------------------------------------------
 
Joe,
 
I've done this, and I'll give you a basic overview of what I've done, 
but there may be better ways to do it, because I was fairly new to OSG 
at the time, and some of my ideas may be obsolete these days.
 
The GDAL OSG plugin will give you image data (pixels), but will not 
provide the geo-referencing data, so you'll have to link to GDAL 
directly to get the geographic extents of each tile. Shane is right that

the A.TOC file is not supported by OSG, so I had to just load all the 
map tiles which existed in a directory, building my own index of tiles 
with their extents in them.
 
I do all the paging myself, going through the index and finding out 
what's in range and loading it if need-be. This could probably be done a

lot more elegantly using the PagedLOD class, but I found that in 
practice, what I do is fairly fast.
 
Check the GDAL documentation, and look for GetGeoTransform(). This 
returns a bunch of numbers in an array, but one of the GDAL examples 
will tell you what each number represents (lat/long, degrees per pixel, 
etc.).
 
You'll need to come up with a projection to map the Lat/Long to some 
kind of XYZ that can be used by OSG. I use SEDRIS (www.sedris.org) for 
my coordinate conversions these days because it will convert from 
anything to anything else (Geodetic, Geocentric, UTM, MGRS, and more). 
Check the license to make sure you're comfortable with it. It's free to 
use, and available in source form, but they have their own license. For 
your purposes though, there's likely a simpler way to do your coordinate

conversion.
 
Good luck.
 
Alan.
 
Glenn Waldron wrote:
 
> Supposedly GDAL does support the TOC for CADRG/CIB:
> 
> http://www.gdal.org/frmt_various.html (search for "RPF")
> 
> You might be able to coerce osgEarth's GDAL driver into doing what you

> want.
> 
> 
> Glenn Waldron : Pelican Mapping : http://pelicanmapping.com : 
> +1.703.652.4791
> 
> 
> On Tue, Apr 28, 2009 at 11:28 AM, Tueller, Shayne R Civ USAF AFMC 519 
> SMXS/MXDEC <Shayne.Tueller at hill.af.mil
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.o
rg>  
> <mailto:Shayne.Tueller at hill.af.mil
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.o
rg> >> wrote:
> 
>     Joe,
> 
>     >From what I understand, GDAL will import a single CADRG image but
>     it won't
>     handle the dynamic decompression and different map resolutions as
>     you zoom
>     in and out (the A.TOC file). I've done some moving map support
>     using OSG for
>     our software but I built my own paged moving map database using
>     the OSG
>     paging database support with different CADRG images. It seems to
>     work for
>     what we need.
> 
>     IMO, I think a "real" moving map plugin that fully handles the
>     CADRG format
>     would be something useful in OSG...
> 
>     -Shayne
> 
>     -----Original Message-----
>     From: osg-users-bounces at lists.openscenegraph.org
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.o
rg> 
>     <mailto:osg-users-bounces at lists.openscenegraph.org
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.o
rg> >
>     [mailto:osg-users-bounces at lists.openscenegraph.org
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.o
rg> 
>     <mailto:osg-users-bounces at lists.openscenegraph.org
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.o
rg> >] On Behalf Of
>     Sullivan,
>     Joseph (CDR)
>     Sent: Tuesday, April 28, 2009 8:21 AM
>     To: osg-users at lists.openscenegraph.org
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.o
rg> 
>     <mailto:osg-users at lists.openscenegraph.org
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.o
rg> >
>     Subject: [osg-users] Simple moving map using CADRG data
> 
>     Hello,
> 
>     I posted this earlier but it may have gotten lost in the shuffle.
> 
>     I'm interested in adding a moving map display to a simulation.
>      (Something
>     like an instructor operator station.)  I understand GDAL can
>     import CADRG
>     data but I haven't found an easy way to use that data to create a
>     moving map
>     display.
> 
>     Have others implemented anything like this ?  If so, any tips or
>     suggestions
>     appreciated.  Is this something others in the community would find
>     useful?
> 
>     Thanks,
> 
>     Joe
> 

 

 



________________________________



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

 

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

Reply via email to