Step by step.

 I've done a little script[1] that chops a big GeoTIFF in tiles using
gdal[2], and generates the .shp index file. Feel free to put it in the
GeoTools doc if you found it interesting.

 Tomorrow I'll try using ImageMosaic to load the image (I suppose that I
only have to load the .shp file and the plugin do the .tif loading
itself).

 :)

[1]
-- BEGIN SCRIPT
#!/bin/bash
# 
# This script divides a GeoTIFF file in tiles and generates a .shp index
file.
#
# Diego Fdez. Durán <[EMAIL PROTECTED]>
#       AAC IAF - Universidad de León - 2007


TILESIZE=256
STORE_DIR="tiles"
INDEX_FILE="index_tiles.shp"

usage() {
        echo "Usage: $0 file.tif [tilesize]"
}

if [ -n "$1" ] && [ -e $1 ]; then
        MAP_FILE=$1
else
        usage
        exit -1;
fi

STR=( `gdalinfo $MAP_FILE | grep ^Size | cut -d' ' -f3,4 | sed  s/','/'
'/` )
MAP_H_RES=${STR[0]}
MAP_V_RES=${STR[1]}


if [ -n "$2" ]; then
        TILESIZE=$2
fi

if [ ! -d "$STORE_DIR" ]; then
        mkdir $STORE_DIR
fi

let "N_H_TILES=$MAP_H_RES / $TILESIZE"
let "N_V_TILES=$MAP_V_RES / $TILESIZE"
let "N_TILES=$N_H_TILES * $N_V_TILES"


echo "File: $MAP_FILE of ${MAP_H_RES}x${MAP_V_RES}px"
echo "Generating $N_TILES (${N_H_TILES}*${N_V_TILES}) ${TILESIZE}x
${TILESIZE}px tiles"

COUNT=1
for ((i=0; i < N_H_TILES; i++))
do
        let "H_OFFSET=$i * $TILESIZE"
        for ((j=0; j < N_V_TILES; j++))
        do
                let "V_OFFSET=$j * $TILESIZE"
                let "PERCENT=(($COUNT / $N_TILES) * 100)"
                TILE_FILE="tile-${i}_${j}.tif"
                echo -ne "Working: $COUNT/$N_TILES ($PERCENT%) ::
Creating tile $TILE_FILE\r"
                gdal_translate -of GTiff -co "TILED=YES" -srcwin
$H_OFFSET $V_OFFSET $TILESIZE $TILESIZE $MAP_FILE $STORE_DIR/$TILE_FILE
> /dev/null
                let "COUNT=$COUNT + 1"
        done
done


echo "Generating tile index $INDEX_FILE"
gdaltindex tiles_index.shp tiles/*.tif
-- END SCRIPT

[2] http://www.gdal.org/


El sáb, 01-12-2007 a las 14:21 -0800, Jody Garnett escribió:
> They made a BigTIFF "fake specification" recently for which you may want 
> to look around. Creatively named BIGTIFF I think.
> 
> Two things:
> 1) just try it; grab the uDig tech preview
> - http://udig.refractions.net/downloads/ECWDemo.win32.win32.x86.zip
> - http://udig.refractions.net/downloads/jre/jre1.6.0_03.win32.zip  (in 
> zip this JRE into the same folder; it contains imageio-ext for geotiff)
>   (ImageIO is good about leaving the image on disk so it may be slow but 
> you should see something)
> 
> 2)  image moasic (break the image up using gdal or some imageio tools 
> and use a shapefile to keep track of this parts)
> - http://docs.codehaus.org/display/GEOTDOC/Image+Mosaic+Plugin
> The above page links to most of the information I could find (including 
> a tutorial of breaking up a large bluemarble image); I have been using 
> the result (amazing!) but have not tried breaking up an image yet.
> 
> Cheers,
> Jody
> > Hi all:
> >
> >     I'm trying visualize a 2GB (30000x20000px) GeoTIFF. I need to show a
> > 1280x800px viewport of the image and be able to navigate through the
> > full GeoTIFF.
> >
> >     Is there any way to do this? 
> >     
> >             - Directly working with the GeoTIFF.
> >             - Dividing the GeoTIFF in small tiles of 256x256px and doing on 
> > demand
> > loading? (How can I divide the GeoTiFF?)
> >
> >     Can you point me in the right direction?
> >
> >     Thanks in advance.
> >
> >   
> > ------------------------------------------------------------------------
> >
> > -------------------------------------------------------------------------
> > SF.Net email is sponsored by: The Future of Linux Business White Paper
> > from Novell.  From the desktop to the data center, Linux is going
> > mainstream.  Let it simplify your IT future.
> > http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Geotools-gt2-users mailing list
> > Geotools-gt2-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> >   
> 
-- 
Diego Fdez. Durán <[EMAIL PROTECTED]> | http://www.goedi.net
GPG : 925C 9A21 7A11 3B13 6E43 50DB F579 D119 90D2 66BB

Attachment: signature.asc
Description: Esta parte del mensaje está firmada digitalmente

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to