# iMOD User Manual version 4.4 (html)

#### 9.11GEN-files

In iMOD two types of GEN files are distinguished a) the standard GEN file format as developed by ESRI, maker of ArcINFO, ARCGIS, ArcView and b) the GEN file developed for iMOD to generate images from large GEN-files most efficiently.

##### 9.11.1Standard GEN-files

Creating a GEN-file can be done in ArcView3.x by means of the sample script shp2gen.ave
(installdirectory \ESRI\AV_GIS30\ARCVIEW\Samples\scripts\shp2gen.ave). Within ArcGIS this can be performed only by a conversion of the ArcGIS shapefile to a ArcINFO coverage and finally using the command UNGENERATE to create a GEN-file. The syntax of a GEN-file should be as follows:

Points
ID${}_{1}$, X${}_{1}$, Y${}_{1}$
ID${}_{2}$, X${}_{2}$, Y${}_{2}$
..
ID${}_{n}$, X${}_{n}$, Y${}_{n}$
END

Lines
ID${}_{1}$
X${}_{1}$,Y${}_{1}$
X${}_{2}$,Y${}_{2}$
X${}_{3}$,Y${}_{3}$
...
X${}_{n}$,Y${}_{n}$
END
ID${}_{2}$
X${}_{1}$,Y${}_{1}$
X${}_{2}$,Y${}_{2}$
X${}_{3}$,Y${}_{3}$
...
X${}_{n}$,Y${}_{n}$
END
END

Polygons
ID${}_{1}$
X${}_{1}$,Y${}_{1}$
X${}_{2}$,Y${}_{2}$
X${}_{3}$,Y${}_{3}$
...
X${}_{1}$,Y${}_{1}$
END
ID${}_{2}$
X${}_{1}$,Y${}_{1}$
X${}_{2}$,Y${}_{2}$
X${}_{3}$,Y${}_{3}$
...
X${}_{1}$,Y${}_{1}$
END
END

or 3-D representatives as

3-D Polygons
ID${}_{1}$
X${}_{1}$,Y${}_{1}$,Z${}_{1}$
X${}_{2}$,Y${}_{2}$,Z${}_{2}$
X${}_{3}$,Y${}_{3}$,Z${}_{3}$
...
X${}_{1}$,Y${}_{1}$,Z${}_{1}$
END
ID${}_{2}$
X${}_{1}$,Y${}_{1}$,Z${}_{1}$
X${}_{2}$,Y${}_{2}$,Z${}_{2}$
X${}_{3}$,Y${}_{3}$,Z${}_{3}$
...
X${}_{1}$,Y${}_{1}$,Z${}_{1}$
END
END

Note: iMOD will display 3-D Polygons as filled surfaces in the 3-D tool.

3-D Lines
ID${}_{1}$
X${}_{1}$,Y${}_{1}$,Z${}_{1}$
X${}_{2}$,Y${}_{2}$,Z${}_{2}$
X${}_{3}$,Y${}_{3}$,Z${}_{3}$
...
X${}_{n}$,Y${}_{n}$,Z${}_{n}$
END
ID${}_{2}$
X${}_{1}$,Y${}_{1}$,Z${}_{1}$
X${}_{2}$,Y${}_{2}$,Z${}_{2}$
X${}_{3}$,Y${}_{3}$,Z${}_{3}$
...
X${}_{n}$,Y${}_{n}$,Z${}_{n}$
END
END

Note: The ID field is read by iMOD as a character-type, thus ID can be an integer, real or character, e.g. ID=1, or ID=3.22 or ID=Area1. Make sure that quotes are use for ID field with spaces or commas; such as ID=“Area 1”.

##### 9.11.2iMOD GEN-files

The GEN file format for iMOD is optimized for usage in iMOD and to represent large GEN-files efficiently. The file format is a binary format and consists out of coordinates as well as attributes for existing labels.

XMIN(real*8),YMIN(real*8),XMAX(real*8),YMAX(real*8)
MAXPOL(integer*4),MAXCOL(integer*4)

add following in case MAXCOL > 0

COLWIDTH(integer*4)[dimension MAXCOL]
LABELS(character*11)[dimension MAXCOL]

repeat following for MAXPOL

NPOINTS(integer*4),ITYPE(integer*4)

add following in case MAXCOL > 0

LABELS(character*COLWIDTH[dimension MAXCOL])[dimension MAXCOL]

add these representing the points (ITYPE=1027), polygons (ITYPE=1025), rectangles (ITYPE=1026), circle (ITYPE=1024) and lines (ITYPE=1028)

XMIN(real*8),YMIN(real*8),XMAX(real*8),YMAX(real*8)
X(real*8),Y(real*8))[dimension NPOINTS]

Note: Whenever ITYPE=1024 (circle), the first point if the midpoint of the circle, the second point is any point on the circle. iMOD uses this point to set the radius.

Note: A BINARY GEN File is an unformatted sequential file with a record oriented file format. For every record some book-keeping fields are typically written to the file to enable the processor to navigate from record to record. Details may vary from compiler to compiler, but there is a reasonable amount of consistency out there across compilers. Scripting languages such as Python need to consider these whenever this BINARY GEN Files need to be read or written by them.

The above mentioned format is slightly different whenever labels are absent, some of the entries can be skipped for those cases. The size of the labels for the attributes is limited to 11 characters, this is similar are present in the DBF-files from ESRI-ArcGIS. Below two examples are given (in ascii) but need to be written in binary format.

Example 1: Two lines with two points and no labels

100.0D0 100.0D0 200.0D0 200.0D0
2 0
2 1028
100.0D0 100.0D0 200.0D0 200.0D0
2 1028
100.0D0 100.0D0 200.0D0 200.0D0

Example 2: A single circle with two points (centre) and point on radius and no labels

100.0D0 100.0D0 200.0D0 200.0D0
1 0
2 1024
100.0D0 100.0D0 200.0D0 200.0D0

Example 3: A single polygon with three points and two labels

100.0D0 100.0D0 200.0D0 200.0D0
1 2
11 20
IDENTIFIC.NAMEOFLABEL
2 1024
IDENT.1213STREETBLK_ISSUE-323Q
100.0D0 100.0D0 200.0D0 200.0D0
100.0D0 100.0D0 200.0D0 200.0D0