tsmApi: Tutorial


COPYING DATA


Copying datasets, or parts of datasets, from one place to another is quite a common task. tsmApi therefore provides a number of useful routines to make this easier for you.

Datasets are composed of two separate pieces of information: the raw data (tiles), and the information describing that data (the tspec file, or files). So tsmApi provides you with routines to copy tile data as well as the tspec data for a dataset.

In order to use these functions, you will have to open two connections. One connection is to the dataset you wish to read data from, the other connection is to the dataset you wish to copy (write) the data to. The following copying functions are provided:

  1. tsmCopyTile(input,output,tx,ty,level) : copies a single tile from one connection to another.
  2. tsmCopyLevelTiles(input,output,level) : copies an entire level of tiles from one connection to another.
  3. tsmCopyAllTiles(input,output) : copies every tile from one connection to another.
  4. tsmCopyTspec(input,output) : copies the tspec data from one connection to another.
For example, the following code segment illustrates how you could write a program to copy an entire dataset (tiles and tspec) from one place to another:
   input  = tsmConnect( input_url, "r", NULL );
   output = tsmConnect( output_url, "w", NULL );

   tsmCopyTspec( input, output );
   tsmCopyAllTiles( input, output );

   tsmDisconnect( input );
   tsmDisconnect( output );


Next Tutorial: Parsing Command Line Arguments
Previous Tutorial: Atomic Tile Allocating and Reading
Manual Page References: tsmCopyTile, tsmCopyLevelTiles, tsmCopyAllTiles, tsmCopyTspec


Back to The tsmApi Home Page / The tsmApi Tutorials Page

Martin Reddy, <reddy@ai.sri.com> / Yvan Leclerc, <leclerc@ai.sri.com>
Last modified: Wed Aug 23 00:45:33 PDT 2000