NAME

Rcreate - Create a new CSF-Raster-file

SYNOPSIS

#include "csf.h"

MAP *Rcreate
(
	const char *fileName,
	size_t nrRows,
	size_t nrCols,
	CSF_CR cellRepr,
	CSF_VS dataType,
	CSF_PT projection,
	REAL8 xUL,
	REAL8 yUL,
	REAL8 angle,
	REAL8 cellSize
);

PARAMETERS

const char *fileName
name of the file to be created
size_t nrRows
the number of rows
size_t nrCols
the number of columns
CSF_CR cellRepr
the cell representation must be complaint with the data type

Possible values for a

CSF_CR
are as follows: * preferred version 2 cell representations * other version 2 cell representations * version 1 cell representations these can be returned by BUT NOT passed to a csf2 function * this one CANNOT be returned by NOR passed to a csf2 function
CSF_VS dataType
a.k.a. the value scale.

Possible values for a

CSF_VS
are as follows: * version 1 datatypes, these can be returned by BUT NOT passed to a csf2 function * version 2 datatypes these two can be returned by or passed to a csf2 function * this one CANNOT be returned by NOR passed to a csf2 function
CSF_PT projection
Possible values for a
CSF_PT
are as follows: * these two can be returned by or passed to a csf2 function * this one CANNOT be returned by NOR passed to a csf2 function
REAL8 xUL
x co-ordinate of upper left
REAL8 yUL
y co-ordinate of upper left
REAL8 angle
counter clockwise rotation angle of the grid top compared to the x-axis in radians. Legal value are between -0.5 pi and 0.5 pi
REAL8 cellSize
cell size of pixel

DESCRIPTION

The Rcreate function creates a new CSF-Raster-file of nrRows by nrCols where each cell is of type cellRepr. If the file already exists its contents is destroyed. The value of the pixels is undefined. MinMaxStatus is MM_KEEPTRACK. The access mode is M_READ_WRITE. It is not known if a file is created after a NOSPACE message.

RETURNS

if the file is created successfully, Rcreate returns a map handle. In case of an error Rcreate returns NULL.

MERRNO

NOCORE, BAD_CELLREPR, BAD_PROJECTION, OPENFAILED, NOSPACE. CONFL_CELLREPR and BAD_VALUESCALE will generate a failed assertion in DEBUG mode.

EXAMPLE

#include "csf.h" 

extern void DoSomethingToFillTheMap(MAP *map);

void main(void) 
{    

 MAP *map; 

 /* create a boolean map named "map.dat"
  * with 250 rows and 200 columns
  * the projection has its y co-ordinate increasing
  * from top to bottom 
  * the top left co-ordinate is (X,Y) = (1200,1000)
  * the map is rotated counter clockwise 1.34 radians 
  * with the top left as rotation point
  * cells are 25 units wide
  */
 map = Rcreate("map.dat",250, 200, CR_UINT1, VS_BOOLEAN, 
                 PT_YINCT2B, 1200.0, 1000.0, 1.34, 25.0);

 if (map == NULL) 
 {     
  Mperror("map.dat"); 
  exit(1);
 }

 DoSomethingToFillTheMap(map);

 /* close CSF-file before exiting  
  */
 Mclose(map); 

 exit(0);
}