Hi Jean; I have tried to make terrain like you from 
http://www.palomino3d.com/pal/openscenegraph/#GIS tutorial. And Fortuanetly 
create my own terrain with http://seamless.usgs.gov/ downloading some data. I 
have a unix shell which coded by Tim Brooks who are administrator of palomino3d 
web site.  I don't understand very well what is your problem in creating 
terrain but it will probably help you! Ümit UZUN > Date: Fri, 11 Jan 2008 
11:03:50 +0000> From: [EMAIL PROTECTED]> To: 
[email protected]> Subject: Re: [osg-users] VPB in SVN> > HI 
JS,> > Thanks for the data and instructions. I have tried them and they work> 
fine on my linux box - the build runs for 40 seconds and results on a> scene 
that can be viewed with osgviewer without problem.> > One difference I use, but 
this won't effect the result, is rather than> making a sub directory, cd'ing 
into and then do a build from there is> to create the sub directory and then 
build from the original directory> i.e
 .> > mkdir output> > osgdem -d NED_59396523.tif -t NED_59396523.tif --terrain 
-o> output/test.ive -v 0.08> > Then to view> > osgviewer output/test.ive> > 
I've also tried using a .osga archive and it works fine too. FYI, The> cd'ing 
into output directly used to be required in the early days of> osgdem, but 
these days it'll automatically handle the subdirectory> specification.> > The 
fact that the database build and viewing works for for me, and not> for you, 
suggests that either VPB or OSG or both are at fault in some> way. In what way? 
I have no clue. We'll just have to step through> the various possibilities one 
by one.> > As a test I've just run the following:> > osgdem -d NED_59396523.tif 
-t NED_59396523.tif --terrain -o> test.ive -v 0.08 -a test.osga -l 1> > The 
resulting test.osga is attached. This depends on the latest> version of the OSG 
in SVN (last check in was yesterday) as it'll need> the latest additions to 
.ive for osgTerrain support. Could you load> this and se
 e what you get in the viewer.> > Another test would be to run the above 
command line to see what> test.osga you get out, in theory is should be the 
same as I'm getting> on my machine.> > Robert.> > On Jan 10, 2008 8:50 PM, 
Jean-Sébastien Guay> <[EMAIL PROTECTED]> wrote:> > Hello Robert,> >> > > Any 
chance you could make available the data and osgdem commndline> > > you've 
used?> >> > I've put the data at> >> > 
http://whitestar02.webhop.org/files/OSG/NED_59396523.zip> >> > It's about 24MB. 
I'll remove it once you've gotten it... It comes from> > 
http://seamless.usgs.gov/, as instructed by the short tutorial at> >> > 
http://www.palomino3d.com/pal/openscenegraph/#GIS> >> > (I selected a part of 
the western US seaboard, I think around Seattle,> > Washington)> >> > The 
command lines I used were taken from that as well:> >> > mkdir test> > cd test> 
> <path>/osgdem -d ../NED_59396523.tif -t ../NED_59396523.tif -o> > terrain.ive 
-a terrain.osga -l 8 -v 0.08> >> > and> >
 > > mkdir test> > cd test> > <path>/osgdem -d ../NED_59396523.tif -t 
 > > ../NED_59396523.tif> > --terrain -o terrain.ive -a terrain.osga -l 8 -v 
 > > 0.08> >> > Let me know if that helps, or if you need something else.> >> 
 > > >> > J-S> > --> > ______________________________________________________> 
 > > > Jean-Sebastien Guay [EMAIL PROTECTED]> > http://whitestar02.webhop.org/> 
 > > >> > ----------------------------------------------------------------> > 
 > > This message was sent using IMP, the Internet Messaging Program.> >> >> > 
 > > _______________________________________________> > osg-users mailing list> 
 > > > [email protected]> > 
 > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org> 
 > > >
_________________________________________________________________
Yeni nesil Windows Live Servisleri’ne şimdi ulaşın!
http://get.live.com
#!/bin/bash
# Jim Brooks
#
# Produce an OSG scene graph from DEM and GeoTIF files
# downloaded from USGS Seamless Data Distribution System (SDDS).
# ------------------------------------------------------------------------------

LEVELS=5
VERT_SCALE="0.075"
SCALE="5000.0,5000.0,5000.0"
POSITION="0,0,0"
TIF_SIZE="20% 20%"
OSGDEM_ARGS="--PagedLOD --RGB-16 --default-color 0,0,0,0 --compressed"
OSGDEM_ARGS="$OSGDEM_ARGS --no-terrain-simplification"
OSGDEM_ARGS="$OSGDEM_ARGS --mip-mapping-hardware --mip-mapping-imagery"
OSGDEM_ARGS="$OSGDEM_ARGS -l $LEVELS -v $VERT_SCALE"
OSGA=""
NAME=""  # implied from name.osga arg

# Prepare
rm -f temp*

if [ "$1" = "" ] || [ "$1" = "-h" ]; then
    echo "Usage: [-l levels] [-s percent] output.osga file.dem file.tif 
[file2.tif ...]"
    echo "Args can be in any order as their purpose is implied by their suffix."
    echo "DEM has the height data.  TIF has data for color texture."
    exit 1
fi

# Return in EXT var a file's extension or empty string.
FileExt()
{
    FILE=$1

    # If file doesn't have an extension,
    # sed will return the whole filename.
    EXT=`echo $FILE | sed -e 's/.*\.//'`
    if [ "$EXT" = "$FILE" ]; then
        EXT=""
    fi
}

# Build args for osgdem
while [ $# -gt 0 ]
do
    # USGS provides DEM files as GeoTIF files name NED_*.tif
    if [ "$1" = "-l" ]; then
        shift
        LEVELS="$1"
        echo "Levels = $LEVELS"
    elif [ "$1" = "-s" ]; then
        shift
        TIF_SIZE="${1}% ${1}%"
        echo "TIF reduction size = $TIF_SIZE"
    else
        FILE=$1
        FileExt $1  # result in EXT
        BASENAME=`basename $FILE .${EXT}`

                if ( echo $FILE | grep -q temp ); then
                # In case *.tif picked a temp file.
                :
            elif ( echo $FILE | grep -q NED_ ); then
                [ -f $FILE ] || exit 1
                #OSGDEM_ARGS="$OSGDEM_ARGS -d $FILE"
                # -d arg must precede -t args
                OSGDEM_DEM_ARG="$OSGDEM_DEM_ARG -d $FILE"
            elif [ "$EXT" = "tif" ] || [ "$EXT" = "TIF" ]; then
                [ -f $FILE ] || exit 1
                # Reduce TIF.
                echo "Reducing the size of ${FILE}..."
                rm -f temp.tif
                SMALL_TIF="temp_${FILE}"
                gdal_translate -outsize $TIF_SIZE $FILE $SMALL_TIF || exit 1
                # Add reduced TIF as arg.
                OSGDEM_ARGS="$OSGDEM_ARGS -t $SMALL_TIF"
            elif [ "$EXT" = "osga" ]; then
                NAME="$BASENAME"
                OSGA="$FILE"
                OSGDEM_ARGS="$OSGDEM_ARGS -o ${BASENAME}.ive -a $FILE"
            else
                echo "ERROR: $1 arg unrecognized."
                exit 1
            fi
    fi

    shift
done

# -d arg must precede -t args
OSGDEM_ARGS="$OSGDEM_DEM_ARG $OSGDEM_ARGS"

# Checks.
if [ "$OSGA" = "" ]; then
    echo "ERROR: .osga arg required."
    exit 1
fi

if [ "$NAME" = "" ] || [ "$OSGDEM_DEM_ARG" = "" ]; then
    echo "ERROR: oops."
    exit 1
fi

# Confirm.
echo "---------------------"
echo "osgdem args shall be:"
echo "$OSGDEM_ARGS"
echo "Other args shall be:"
echo "$VERT_SCALE $SCALE $POSITION $TIF_SIZE"
#echo "Press Enter to proceed..."
#read INPUT

# Prepare.
rm -f $OSGA

# Produce .osga file from GIS data.
osgdem $OSGDEM_ARGS || exit 1

# Reduce size of OSG geometry.
# Extract .ive, convert its scale, re-insert it in .osga archive.
osgarchive -a ${NAME}.osga -e ${NAME}.ive || exit 1
osgconv -s $SCALE -t $POSITION ${NAME}.ive temp.ive || exit 1
mv -f temp.ive ${NAME}.ive || exit 1
osgarchive -a ${NAME}.osga -i ${NAME}.ive || exit 1

# Clean.
rm -f ${NAME}.ive temp*

# Yippy!
echo " "
echo "Succeeded."
exit 0
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to