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
- CR_UINT1 - Boolean, ldd and small nominal and small ordinal.
- CR_INT4 - Large nominal and large ordinal.
- CR_REAL4 - Single scalar and single directional.
* other version 2 cell representations
- CR_REAL8 - Double scalar or directional, and also the only type that
can hold all
cell representation without loss of precision.
* version 1 cell representations
these can be returned by BUT NOT passed to a csf2 function
- CR_INT1 -
.
- CR_INT2 -
.
- CR_UINT2 -
.
- CR_UINT4 -
.
* this one CANNOT be returned by NOR passed to a csf2 function
- CR_UNDEFINED - Just some value different from the rest.
-
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
- VS_NOTDETERMINED - Version 1.
- VS_CLASSIFIED - Version 1.
- VS_CONTINUOUS - Version 1.
* version 2 datatypes
these two can be returned by or passed to a csf2 function
- VS_BOOLEAN - Boolean, always UINT1, values: 0,1 or MV_UINT1.
- VS_NOMINAL - Nominal, UINT1 or INT4.
- VS_ORDINAL - Ordinal, UINT1 or INT4.
- VS_SCALAR - Scalar, REAL4 or (maybe) REAL8.
- VS_DIRECTION - Directional REAL4 or (maybe) REAL8, -1 means no direction.
- VS_LDD - Local drain direction, always UINT1, values: 1-9 or MV_UINT1.
* this one CANNOT be returned by NOR passed to a csf2 function
- VS_UNDEFINED - Just some value different from the rest.
-
CSF_PT projection
-
Possible values for a
CSF_PT
are as follows:
* these two can be returned by or passed to a csf2 function
- PT_YINCT2B - Y increase from top to bottom.
- PT_YDECT2B - Y decrease from top to bottom.
* this one CANNOT be returned by NOR passed to a csf2 function
- PT_UNDEFINED - Just some value different from the rest.
-
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);
}