A script is a sequenced list of ILWIS commands and expressions. By creating a script, you can build a complete GIS or Remote Sensing analysis for your own research discipline.
This topic consists of a number of sections:
2. Expressions for calculations and operations: |
|
Each line in a script is a statement that is executed via the ILWIS command line of the Main window. Via a script, you can for instance handle some necessary object management (e.g. copy or delete), display of objects (open or show), and the creation and calculation of data objects. All map and table calculations, and all ILWIS expressions to perform operations may be used. Furthermore, you can call other scripts and start other Windows applications from within a script.
When you run a script, no dialog boxes appear and no questions are asked; all lines in the script are simply performed. Error messages appear in case syntax errors are detected in a MapCalc expression, in a TabCalc expression, in an expression for another operation, or in a script command. Further error messages appear when a script command is not recognized, or when required objects are not found. A script line is ignored when the syntax is correct and necessary objects are found but the command cannot be performed otherwise (e.g. creating objects that already exist, missing or wrong extensions during a copy).
To use long directory names and/or long file names, the object name including a possible path should be enclosed in single quotes. For more information, see How to use long object names.
Parameters in scripts:
A script can use parameters. Parameters in a script replace (parts of) object names, operations, etc. Parameters in scripts work as DOS replaceable parameters in DOS batch files, and must be written on the Script Tab in the script editor as %1, %2, %3, up to %9. For more information, see How to use parameters in scripts.
To run a script:
In How to run scripts you will find procedures to run scripts, e.g. run script with or without parameters, run script from the command line, etc.
Example:
In How to use parameters in scripts two script examples are given. A more elaborated example of a script to create slope maps in percentages and in degrees is presented in Map and Table calculation : creating and running scripts.
Note:
Single text lines of a script, i.e. the commands and expressions described below, can also be typed on the command line of the Main window or the Table window. To avoid any dialog boxes when typing on the command line, you can use a semicolon ; at the end of a command line expression. In a script, semicolons at the end of a line are not required.
Most text lines in a script will consist of MapCalc and TabCalc expressions and expressions of operations that you can also type on the command line of the Main window or on the command line of a Table window. You should be familiar with these expressions.
For MapCalc expressions, no special syntax is required: you can simply type the MapCalc expression as you would type it on the command line of the Main window.
For example, to sum maps map1 and map2 to create map3, type in the script:
map3=map1+map2
By this expression, map3 is defined but not yet calculated. You can continue defining other (intermediate) maps, but at the end of a series of calculations, it is advised to calculate the last output map of these calculations. Intermediate maps will be calculated automatically when the final map is calculated.
To force the calculation of a final map of a series of calculations, use:
calc mapname.mpr
The script will continue with the next line, only after the calculation has finished.
Mind: For the calc command in a script, the extension of the object to be calculated is required.
For TabCalc expressions, it is necessary that you type tabcalc tablename in front of the tabcalc expression. For example, to sum columns col1 and col2 in table MyTable and to store the results in column col3, type in the script:
tabcalc MyTable col3=col1+col2
For the tabcalc command in a script and when calculating with tables, the extension .TBT is not required. Only to calculate with columns in table-like objects which can be opened as a table, e.g. histograms, point maps, class representations (see also How to open objects as a table), an extension is required. To calculate with the histogram of raster map MyMap, you can type e.g.:
tabcalc MyMap.his a=b+c
Columns of the ColumnCalculate type, i.e. result of normal column calculations, will directly both be defined and calculated. There is no thus need to use the calc command separately as with MapCalc.
However, you must force the calculation of columns which are not of the ColumnCalculate type, e.g. result of an aggregation or a join, when you wish to make further calculations on the aggregation or join results. This includes for instance columns of the types ColumnAggregate, ColumnJoin, and ColumnLeastSquaresFit. To force the calculation of such columns, you can use:
calc tablename.ext |
In table tablename.ext, (re)calculate all columns. |
calccol tablename.ext.columnname |
|
|
In table tablename.ext, (re)calculate column columnname. |
The script will continue with the next line, only after the calculation has finished.
Mind: For the calc and the calccol commands in a script, the extension of the object to be calculated is required.
Finally, when you wish to perform a series of calculations in one table, it is advised to use the following script commands:
opentbl tablename.ext |
Keep the table tablename.ext open; first line in the script before a series of TabCalc expressions on one table. |
closetbl tablename.ext |
Close the open table tablename.ext; last line in the script after a series of TabCalc expressions on one table. |
To perform ILWIS operations, you can use any ILWIS expression as described in Appendices : ILWIS expressions. To cross for example two maps (map1 and map2) and obtain a cross table (m1m2cr), type in the script:
m1m2cr = TableCross(map1,map2)
calc m1m2cr.tbt
For operations which result in a map, it is not necessary to force the calculation of temporary output objects. It is sufficient to force the calculation of the last output object in a series of calculations and operations, like in MapCalc.
However, for operations which result in a table, and when you wish to calculate with the columns in that table later on in the script, it is strongly recommended to force the calculation of the output table immediately after the operation. Some frequently used operations which result in a table are for instance: TableCross and all TableHistogram operations. To calculate for instance the histogram of raster map band1 and then do some further calculations in the histogram, use:
band1 = TableHistogram(band1)
calc band1.his
tabcalc band1.his col3=iff(area<500,0,area)
In general, it is not necessary to specify the extensions of input or output objects of operations, although the ILWIS.LOG file and the command line may suggest so. Only when an operation can use multiple types of input objects for a certain parameter, the extension of the desired object must be specified. Furthermore, it is not required to specify domain type and/or value range for every output object: the script will use defaults as in the Raster Map Definition dialog box and in any dialog box of an operation.
A number of additional script commands is available for data management, to show objects, handle object properties, edit object properties, create objects, calling other scripts, etc.
In many of the following script commands, object names and extensions of their object definition files must be specified (see also Appendices : object definition files). In some script commands, you are allowed to use wildcards * and ? to specify object names and their extensions (object.ext and table.ext.col).
When using a script command that works on a column in a table (table.ext.col), you can ignore the extension when the table has extension .TBT. Table extensions only need to be specified when the column is stored in a histogram, a point map, a class representation, a georeference tiepoints, etc. For more information, see How to open objects as a table.
Further, in the list below, optional parameters of script commands are shown between square brackets. Omit these square brackets when writing a script. Square brackets are only recognized for TabCalc expressions to indicate a specific record in a table.
Remarks/comments, messages and pause:
rem This is a remark |
All text on this line after rem is ignored by the script. In this manner, you can document your script expressions. |
// This is a remark |
All text on this line after // is ignored by the script. In this manner, you can document your script expressions. |
begincomment this line is comment this line is comment endcomment |
All lines of text between the commands begincomment and endcomment are ignored by the script. In this manner, you can document your script expressions and you can temporarily exclude parts of your script. |
message Text in message box on my screen |
|
|
Obtain a message box on the screen with any text; the text can be as long as you like. After pressing the OK button in the message box, the script will continue. In this manner, you can display texts on the screen during demos, etc. |
pause seconds |
Stop the script for a certain amount of time (seconds). You can use this command for instance when you want to show multiple maps and give the user time to view each one of them. |
Open/Show an object:
show object.ext |
Open/show object object.ext. |
open object.ext |
Open/show object object.ext. |
open object.ext -noask |
Open/show object object.ext with its default display options, i.e. a Display Options dialog box will be skipped. You can use this command for instance to quickly show a map on the screen. |
anaglyph stereopair.stp -noask |
|
|
Open/show a stereo pair stereopair.stp as an anaglyph with its default display options, i.e. the anaglyph's Display Options dialog box will be skipped. |
setnextwindowrect X, Y, width, height |
|
|
Specify the position and size of the next window; the map or table that is displayed next will be displayed in that window. X and Y specify the top left position of the next window and are expressed in screen pixels measured from the top left of your screen; Width and Height specify the size of the next window and are also expressed in screen pixels. Parameters may be left blank, then ILWIS will decide on defaults. Syntax primarily useable in scripts and DDE. |
closeall |
Close all ILWIS windows except the ILWIS Main window. You can use this command for instance to close any map and/or table windows which are displayed on the screen. |
To open objects with possible user interaction, see also Appendices : ILWIS commands.
Open a pixel info window showing maps, map lists and/or coordinate systems:
pixelinfo object.ext [object.ext [object.ext [...]]]] |
|
|
Open a pixel information window and show one or more objects in this pixel info window specified as object.ext. For object.ext, you can use raster maps (.mpr), polygon maps (.mpa), segment maps (.mps) and point maps (.mpp), map lists (.mpl), and/or coordinate systems (.csy). Furthermore, attribute tables linked to maps or to the domain of a map will be automatically added to the pixel info window. |
Change directory etc.:
cd path |
Change directory to directory path. |
cd d:path |
Change drive to drive d: and change directory to directory path. |
md [drive:]path |
Make directory path. Optionally make directory path on drive drive. |
mkdir [drive:]path |
Make directory path. Optionally make directory on path on drive drive. |
rd [drive:]path |
Remove directory path. Optionally remove directory path from drive drive. |
rmdir [drive:]path |
Remove directory path. Optionally remove directory path from drive drive. |
rd [drive:]path -force |
Remove directory path while deleting all files in that directory. Optionally remove directory path and all files in that directory from drive drive. |
rmdir [drive:]path -force |
Remove directory path while deleting all files in that directory. Optionally remove directory path and all files in that directory from drive drive. |
opendir [drive:]path |
Open a new Catalog and show the contents of directory path; optionally, you can specify the drive drive: as well. |
An error message appears when changing to a directory that does not exist, or when removing a directory that does not exist. The script line is ignored, when when making a directory that already exists, or when deleting files that do not exist.
Copy and delete:
copy object.ext objname |
Copy object object.ext to new name objname. |
copy object.ext objname -breakdep |
|
|
Copy object object.ext to new name objname while breaking the dependency links of object.ext. |
copy object.ext path |
Copy object object.ext to existing directory path. Wildcards are allowed. |
copy object.ext path -breakdep |
|
|
Copy object object.ext to existing directory path while breaking the dependencies of object.ext. Wildcards are allowed. |
copyfile file.ext filename.ext |
Copy file file.ext to new file filename.ext. |
copyfile file.ext path |
Copy file file.ext to existing directory path. Wildcards are allowed. |
When copying objects (or files), you cannot copy objects to another directory and give the object another name at the same time. When copying an object to another directory, existing objects in that directory are not overwritten. In the same way, when copying an object in the current directory to an object name which already exists, the script line is ignored.
del object.ext |
Delete object object.ext.Wildcards are allowed. Objects that are still used by other objects will not be deleted. Also objects that are used by object.ext will not be deleted. However, when deleting a domain, the representation(s) that use this domain are not taken into account; thus the domain will be deleted while the representations will remain (and vice versa). |
del object.ext -force |
Delete object object.ext even when this object is still used by other objects. This command also tries to delete object object.ext which is not completely valid (i.e. an error occurs when the object is opened). Wildcards are allowed. To remove the contents of a complete directory, use del *.* -force. |
delcol table.ext.column |
Delete column table.ext.column.Columns which are table-owned will not be deleted. |
delfile file.ext |
Delete file file.ext as if this file was deleted in DOS or the File Manager. Wildcards are allowed. |
Read-only objects will never be deleted. A del command is ignored when objects, columns or files do not exist.
Handling properties of dependent objects:
update object.ext |
Make the dependent map or table object.ext up-to-date. Wildcards are allowed. |
updatecol table.ext.column |
Make dependent column table.ext.column up-to-date. |
breakdep object.ext |
Break the dependency links of dependent map or table object.ext. Wildcards are allowed. |
breakdep object.ext -force |
Tries to break the dependency links of dependent map object.ext which is not completely valid (i.e. an error occurs when the object is opened). Wildcards are allowed. |
breakdepcol table.ext.column |
Break the dependency links of dependent column column in table table.ext. |
reldisksp object.ext |
Delete the data file(s) of dependent object object.ext. |
calc object.ext |
Recalculate the data files of dependent map or table object.ext. Wildcards are allowed. |
calccol table.ext.col |
Recalculate dependent column table.ext.col. |
editdef rasmap.mpr |
For a dependent raster map rasmap.mpr created with a MapCalc formula: open the map's Raster Map Definition dialog box. You can manually change the MapCalc expression of the map and then recalculate the raster map with a calc command (see above). This command is the same as clicking the Edit Definition button in a Raster Map Property sheet. |
setdescr object.ext Any text |
Change the description of object object.ext to Any text. |
For more information, see Basic concepts : properties of objects.
Editing properties of editable source objects (advanced):
changedom object.ext domname [valuerange] |
|
|
Change the domain of raster, polygon, segment or point map object.ext to existing domain domname, while converting the class names, IDs, or values of the original domain into new domain domname. Optionally, in case of a value domain domname, set the value range of the object to valuerange. Specify the value range as min:max:precision, as min:max, or as ::precision. This is a rather safe way to change the domain of a map into another domain or to change the precision of a map. |
setdom object.ext domname [valuerange] [-force] |
|
|
Set the domain of object.ext to domname. Wildcards are allowed for object.ext. Optionally, in case of a value domain domname, set the value range of the object to valuerange. Specify the value range as min:max:precision, as min:max, or as ::precision. When you also specify the -force flag, no checks are performed. |
setvr object.ext valuerange |
Set the value range of object.ext to valuerange. Wildcards are allowed for object.ext. Specify the value range as min:max:precision, as min:max, or as ::precision. |
setgrf rasmap georef |
Set the georeference of raster map rasmap to georef. Wildcards are allowed for rasmap. |
setcsy map.ext coordsys |
Set the coordinate system of point, segment or polygon map map.ext to coordsys. Wildcards are allowed for map.ext. |
setcsy georef coordsys |
Set the coordinate system of georeference georef to coordsys. Wildcards are allowed for georef. |
setreadonly object.ext |
Mark object object.ext as read only. Read only objects cannot be edited or deleted. Wildcards are allowed. |
setreadwrite object.ext |
Remove the read only flag for object object.ext: the objects are editable and deleteable. Wildcards are allowed. |
setatttable map.ext atttable |
|
|
Set the attribute table of class or ID map map.ext to atttable. Wildcards are allowed for map.ext. |
setatttable map.ext |
Remove the link between class or ID map map.ext and its attribute table. Wildcards are allowed. |
setdescr object.ext Any text |
Change the description of object object.ext to Any text. |
The setdom, setvr, setgrf, setscy, setatttable and setdescr commands are only performed on objects that are not read only.
Creating (empty) maps and tables:
crmap map georef domname |
Create raster map map with existing georeference georef and existing domain domname. |
crsegmap map crdsys [MinX MinY MaxX MaxY] domname |
|
|
Create segment map with existing coordinate system crdsys and existing domain domname. Optionally, you can specify the coordinate boundaries of the segment map as MinX MinY MaxX MaxY. |
crpntmap map crdsys [MinX MinY MaxX MaxY] domname |
|
|
Create point map map with existing coordinate system crdsys and existing domain domname. Optionally, you can specify the coordinate boundaries of the point map as MinX MinY MaxX MaxY. |
crtbl table domname |
Create table table using existing Class or ID domain domname. |
crtbl table nrrecs |
Create table table using domain None and with a number of records specified as nrrecs. |
crmaplist maplist rasmap1.mpr rasmap2.mpr [rasmap3.mpr [...]] |
|
|
Create map list maplist that should contain a number of raster maps specified as rasmap1.mpr rasmap2.mpr rasmap3.mpr etc. All raster maps must use the same domain and the same georeference. |
Creating domains:
crdom domname [-type=class|ID|group] -items=number [-prefix=prefix] |
|
|
Create domain domname with a number of items specified as -items=number. Optionally, specify: -type=class to create a class domain, or -type=ID to create an ID domain, or -type=Group to create a group domain. If parameter -type is omitted, then a class domain is created. Optionally specify: -prefix=prefix to obtain classes or IDs with a certain prefix. If parameter -prefix is omitted when creating a class domain, classes will obtain prefix class, thus class 1, class 2, etc. If parameter -prefix is omitted when creating an ID domain, the IDs will obtain prefix ID, thus ID 1, ID 2, etc. |
crdom domname -type=value -min=value -max=value [-prec=value] |
|
|
Create value domain domname with a specified value range between -min=value and -max=value. Optionally, specify a precision for the value domain as -prec=value. When this parameter is not specified, precision 1 will be used. |
Examples: |
|
crdom domname -type=class -items=10 -prefix=cl |
|
|
Create class domain domname and add ten items to this domain with class names "cl 1", "cl 2", ... "cl 10". |
crdom domname -type=id -items=100 -prefix=prov |
|
|
Create ID domain domname and add hundred items to this domain with IDs "prov 1", "prov 2", ... "prov 100". |
crdom domname -items=0 |
Create class domain domname without any items. You can add items with the additemtodomain command. |
crdom domname -type=value -min=100 -max=200 |
|
|
Create value domain domname with a value range between 100 and 200 (precision is 1). |
crdom domname -type=value -min=10 -max=20 -prec=0.01 |
|
|
Create value domain domname with a value range between 10.00 and 20.00 and a precision of 0.01. |
The crdom command is ignored when domain domname already exists.
Editing a class, ID or group domain:
additemtodomain domname class [classcode] |
|
|
Add item class, optionally with code classcode, to class or ID domain domname. Class names which contain spaces must be enclosed by double quotes. |
additemtodomaingroup domname upperlimit class [classcode] |
|
|
Add an item to group domain domname. The item is defined by an upperlimit (a real value), a class name class and, optionally, a classcode. |
mergedom domname1 domname2 |
|
|
Merge the items of class or ID domain domname2 into class or ID domain domname1. |
Create representations:
crrpr rprname domname |
Create representation rprname for class or value domain domname. |
The crrpr command is ignored when representation rprname already exists.
Create georeference corners:
crgrf grfname nrrows nrcols [-crdsys=coordsysname] -lowleft=(minX,minY) -upright=(maxX,maxY) | -pixsize=value [-centercorners+] |
|
Create georeference corners grfname with:
Specify the coordinates for the upper right corner as:
Mind: in a script, you are not allowed to use spaces within a coordinate expression (X,Y). Optionally, a coordinate system coordsysname can be specified by using parameter -crdsys=coordsysname, otherwise the system coordinate system Unknown will be used. Furthermore, you can optionally add coordinates to the centers of the corner pixels by using parameter -centercorners+. When this parameter is not used, coordinates will be added to the corners of the corner pixels. |
Examples: |
|
crgrf grfname 500 1000 -crdsys=cs -lowleft=(0,0) -upright=(10000,5000) |
|
|
Create georeference corners grfname with 500 rows and 1000 columns and using coordinate system cs. The coordinate boundaries are defined by the lower left coordinate (0,0) and the upper right coordinate (10000,5000). |
crgrf grfname 500 1000 -crdsys=cs -lowleft=(0,0) -pixsize=10 |
|
|
Create georeference corners grfname with 500 rows and 1000 columns and using coordinate system cs. The georeference has as lower left coordinate (0,0) and as pixel size 10 m. |
Mind: In a script, you are NOT allowed to use spaces within a coordinate expression (X,Y).
The crgrf command is ignored when georeference grfname already exists.
Creating a two-dimensional table:
cr2dim 2dimtablename indomname1 indomname2 outdomname3 [valuerange] |
|
|
Create two-dimensional table 2dimtablename
If outdomname3 is a value domain, you can optionally specify the value range of this domain as min:max or as min:max:precision. |
Creating pyramid layers for one or more raster maps:
createpyramidlayers |
Create pyramid layers (i.e. .MPY# files) for all raster maps in the current directory. |
createpyramidlayers *.mpr |
|
|
Create pyramid layers for all raster maps in the current directory; wildcards are allowed; extension .mpr is obligatory. |
createpyramidlayers rasmap1.mpr rasmap2.mpr |
|
|
Create pyramid layers for raster maps rasmap1 and rasmap2, separate multiple raster maps by a space; wildcards are allowed; the extension .mpr is obligatory. |
createpyramidlayers maplist1.mpl maplist2.mpl |
|
|
Create pyramid layers for the raster maps in map lists maplist1 and maplist2, separate multiple map lists by a space; wildcards are allowed; the extension .mpl is obligatory. |
Pyramid layers (stored in an .MPY# file) speed up the display of large raster maps.
Deleting pyramid layers:
deletepyramidlayers |
Delete the pyramid layers (.i.e. .MPY# files) of all raster maps in the current directory. |
deletepyramidlayers *.mpr |
|
|
Delete the pyramid layers of all raster maps in the current directory; wildcards are allowed; extension *.mpr is obligatory. |
deletepyramidlayers rasmap1.mpr rasmap2.mpr |
|
|
Delete the pyramid layers of raster maps rasmap1 and rasmap2; separate multiple raster maps by a space; the extension .mpr is obligatory. |
Converting domains:
domclasstoid domname[.ext] |
|
|
Convert class domain domname into an ID domain. |
domidtoclass domname[.ext] |
|
|
Convert ID domain domname into a class domain. |
dompictoclass domname[.ext] |
|
|
Convert Picture domain domname.ext into a class domain. |
These are rather safe ways to convert one domain into another. When the domain you want to convert is an internal domain which is stored in a map, you need to specify the extension of the map after the domain name.
Calling other scripts:
run script2 |
Run another script named script2.
|
run script2 parameter parameter |
|
|
Run another script name script2; fill out parameters (map names including extension, etc.). The first parameter specified will be used for %1 in the script, the second for %2, etc. Tip: When you wish to use long object names as parameters for a called script, then you must use single quotes around the long object names, excluding the .ext extensions. For more information, see How to use parameters in scripts or How to use long object names. |
If script2 is not found, an error message appears.
Start other Windows applications:
!expression !expression optional_parameter(s) |
|
|
Starts any Windows application, a batch file, etc. and will wait until the application has finished, i.e. the script will wait until the external application has been closed again.
Examples:
|
!!expression !!expression optional_parameter(s) |
|
|
Same as !expression, but enables a continuation of ILWIS while the external application is running. |
import14 file14.ext [outputdir] |
|
Batch-wise import of file14.ext in the current directory, or optionally to the specified output directory outputdir. Wildcards are allowed. The ILWIS object(s) keep the name(s) of the 1.4 file(s); new extensions are created during import. Domains, representations, georeferences etc. are created using defaults. |
|
import14 file14.ext [ilwis3name|outputdir] [-dmt=domtype] [-dom=domainname] [-grf=georef] |
|
Import an ILWIS 1.4 file file14.ext according to your wishes. All parameters shown above between square brackets can but do not have to be used. |
|
ilwis3name|outputdir |
Either specify an ILWIS 3 object name as ilwis3name for the 1.4 file to be imported, or specify an output directory as outputdir in which the imported object should appear. If this parameter is omitted, then file14.ext is imported in the current directory and the ILWIS 3 object(s) keep the name(s) of the 1.4 file(s). |
-dmt=domtype |
Specify the domain type domtype for the output object as: Picture, Image, Value, Class, or ID. If you specify domain type Class or ID, you also have to use the -dom option to specify the name of that domain. |
-dom=domname |
If you specified domain type Class or ID in the previous option, then also specify a new or existing domname for the output object. |
-grf=georef |
When importing a raster map, you can specify the name of a new or existing georeference georef. |
Tip: For more information on the domain type to choose, see How to import ILWIS 1.4 raster data.
Example: |
|
import14 orotm4.mpd -dmt=image -grf=tmgeoref |
|
Imports 1.4 raster map Orotm4 as an image using existing georeference tiepoints tmgeoref. |
import format(file.ext, ilwobj) |
Import a data file file.ext into an ILWIS object with the name ilwobj. The extension of the input file file.ext must be specified. The extension for the output ILWIS object(s) ilwobj will be automatically created during import. For format, you have to specify one of the following formats: arcinfonas | ascii | bmp | bna | dbase | dxf | e00 | erdas | gartrip | gif | ida | idrisi | infocam | lin | pcx | shape | smt | tiff . |
arcinfonas |
Import an Arc/Info non-compressed ASCII raster file (.NAS or .ASC) to an ILWIS raster map. |
ascii |
Import an ILWIS 1.x ASCII raster file (.ASC) to an ILWIS raster map. |
bmp |
Import a Windows bitmap (.BMP) to an ILWIS raster map. |
bna |
Import an Atlas vector data file (.BNA) to an ILWIS point and/or segment and/or polygon map. |
dxf |
Import an AutoCad .DXF file to an ILWIS point and/or segment and/or polygon map. |
e00 |
Import an Arc/Info file in interchange format (.E00) to an ILWIS raster and/or polygon and/or segment and/or point map. When attributes are available, also an ILWIS table will be created. Note: Optionally, you can specify a third parameter CreatePol within the ( ) brackets to directly polygonize imported segments and points. The syntax then reads: import e00(file.ext, ilwobj, CreatePol) |
erdas |
Import an Erdas .GIS file into an ILWIS raster map; or import an Erdas .LAN file into a single ILWIS raster map or into an ILWIS map list containing multiple raster maps (bands). |
gartrip |
Import a GARtrip file (extension .TXT or other extension) to an ILWIS vector map.
Note: Optionally, you can specify a third parameter height_offset, between the ( ) brackets, to correct Altitude values in an 'Alt' column. A height_offset of 20 will increase all values in the output 'Alt' column with 20. The syntax then reads: import gartrip(file.ext, ilwobj, 20) |
gif |
Import a gif image (.GIF) to an ILWIS raster map. |
ida |
Import an IDA image (.IMG) to an ILWIS raster map. |
idrisi |
Import an Idrisi image (.DOC). to an ILWIS raster map. |
infocam |
Import an Infocam sequential file (.SEQ) to an ILWIS point and/or segment and/or polygon map. When attributes are available, also an ILWIS table will be created. |
lin |
Import an Arc/Info file created with the Ungenerate command (.LIN and .PTS) to an ILWIS segment and/or point map. When the extension of the Arc/Info file is .PTS, you will obtain a point map, otherwise you will obtain a segment map. |
pcx |
Import a PaintBrush image (.PCX) to an ILWIS raster map. |
shape |
Import Arc/View Shape files (.SHP, .SHX, .DBF) to an ILWIS point and/or segment and/or polygon map. Furthermore, an ILWIS table will be created. |
smt |
Import an ILWIS 1.x ASCII vector file (.SMT) to an ILWIS segment map. |
tiff |
Import a Tiff image (.TIF) to an ILWIS raster map. When the Tiff image contains GeoTiff information, a georeference will be created for the imported map; furthermore, it is attempted to create a coordinate system (you can find projection information in the description of the coordinate system). |
Tip:
For more information on Import through ILWIS Map Import, see also the Import Map dialog box, or the import.def file in your ILWIS directory.
Examples: |
|
import erdas(soil.gis, ilwsoil) |
|
|
Imports the Erdas file SOIL.GIS into ILWIS; a raster map with the name ILWSOIL.MPR will be created. The import will also look for the availability of an Erdas file called SOIL.TRL that may accompany the .GIS file. |
import e00(parcel.e00, ilwparc) |
|
|
Imports the Arc/Info interchange file PARCEL.E00 into ILWIS; a segment map, a polygon map, a raster map and a point map can be created (all named ILWPARC), where the vector maps can also be linked to attribute tables. |
Importing ASTER level 1A and/or level 1B images through ILWIS Map Import always results in an ILWIS object collection. Opening an ASTER level 1A image in ILWIS results in an object collection existing of 15 raster maps (4 VNIR bands, 6 SWIR bands and 5 TIR bands), 15 georeferences (one for each band) and 1 coordinate system. Opening an ASTER level 1B image results in an object collection consisting of 15 raster maps, 4 georeferences (VNIR, VNIR3B, SWIR and TIR) and 1 coordinate system. The name of the output object collection is always the same as the name of the imported external file.
open file.ext [-import] [-output=path\] [-noshow] [-usednvalues] open file.ext [-import] [-output=ilwobj] [-noshow] [-usednvalues] open file.ext [-import] [-output=path\ilwobj] [-noshow] [-usednvalues] |
|
open |
Imports a file. |
file.ext |
Name of the external ASTER level 1A or ASTER level 1B file. The file may or may not have an extension. |
-import |
Optional parameter. If specified: data file(s) will be translated into ILWIS data files. If omitted: data file(s) will be used in their original format (UseAs). Service objects like georeferences and coordinate systems will always be imported into the ILWIS format. |
-output=path\ |
Optional parameter. If specified: results will be stored in the specified directory path\; output object(s) IN the object collection will obtain the same name as the output object collection. If omitted: results will be stored in the current directory; output object(s) IN the object collection will obtain the same name as the output object collection. |
-output=ilwobj |
Optional parameter. If specified: results will be stored in the current directory; the output object collection and output object(s) IN the object collection will obtain the specified name ilwobj. If omitted: results will be stored in the current directory; output object(s) IN the object collection will obtain the same name as the output object collection. |
-output=path\ilwobj |
Optional parameter. If specified: results will be stored in the specified directory path\; the output object collection and the output object(s) IN the object collection will obtain the specified name ilwobj. If omitted: results will be stored in the current directory; output object(s) IN the object collection will obtain the same name as the output object collection. |
-noshow |
Optional parameter. If specified: the resulting object collection will not be opened. If omitted: the resulting object collection will be directly opened. |
-usednvalues |
Optional parameter. If specified: the DN values of the ASTER file will not automatically be convert to radiance values. If omitted: the DN values of the ASTER file will automatically be convert to radiance values. |
Tips:
Examples: |
|
open Image_1B.hdf -import -noshow |
|
|
Imports the ASTER level 1B file Image_1B.hdf into ILWIS; an object collection with the name Image_1B.IOC containing 15 raster maps, 4 georeferences and 1 coordinate system will be created. The data file will be translated into ILWIS data files but the resulting object collection will not be opened. |
open PG-PR1A0000-2001032501_22_039 -output=Aster -usednvalues |
|
|
Imports the ASTER level 1A file pg-PR1A0000-2001032501_22_039 into ILWIS; an object collection with the name Aster.IOC containing 15 raster maps, 15 georeferences and 1 coordinate system will be created. The data files will be used in their original format (UseAs) and instead of converting the DN values to radiance values the DN values are converted to sensor calibrated DN values. |
As there are quite some different output possibilities, it is advised to first read the explanations in the Import General Raster dialog box.
OUTMAP |
= |
map(file.ext, GenRas, UseAs | Convert, NrCols, SizeHeader [, Bit | Byte | Int | Real] [, 1 | 2 | 4 | 8] [, NoSwap | SwapBytes] ) |
|
||
OUTMAPLIST |
= |
maplist(file.ext, GenRas, UseAs | Convert, NrCols, NrBands, SizeHeader [, BIL | BSQ | BIP] [, Bit | Byte | Int | Real] [, 1 | 2 | 4 | 8] [, NoSwap | SwapBytes] [, NoMPR | CreateMPR] ) |
OUTMAP |
Name of the output raster map. |
OUTLIST |
Name of the output map list. |
map |
Command line syntax to ensure that the output of general raster import is a raster map. You should use this option when the data file contains only 1 band. |
maplist |
Command line syntax to ensure that the output of general raster import is a map list which may contain multiple raster maps. You sould use this option when the data file contains multiple bands, e.g. Band Interleaved, Band Sequential, or Pixel Interleaved. |
file.ext |
Name and extension of the external file. |
GenRas |
Command line syntax to use General Raster Import. |
UseAs | Convert |
Specify UseAs to create only one or more object definition files and keep the data file(s) in their original format. Specify Convert to translate the data file(s) to the ILWIS raster data format (.MP#). |
NrCols |
Specify the number of columns of a map / band. |
NrBands |
In case of importing a file that contains multiple bands: specify the number of bands that the file contains. |
SizeHeader |
Specify the number of bytes that is used by the header in the external file. |
BIL | BSQ | BIP |
In case of importing a file that contains multiple bands:
|
Bit | Byte | Int | Real |
Optional paramter to specify the type of values that are used by the pixels in the file.
If omitted, Byte will be used. |
1 | 2 | 4 | 8 |
In case you specified Int or Real as the previous parameter, optional parameter to specify the number of bytes that are used to store individual pixel values.
If omitted, 1 will be used (1 byte per pixel). |
NoSwap | SwapBytes |
Optional parameter to specify whether or not bytes should be swapped:
If omitted, NoSwap will be used. |
NoMPR | CreateMPR |
In case of importing a file that contains multiple bands and using the UseAs option, optional parameter to specify whether or not an .MPR file should be created for every band:
If omitted, NoMpr will be used. |
Tip:
For more information, refer to the Import General Raster dialog box.
OUTTABLE |
= |
table(file.ext, Comma | Space | ILWIS14 | DBF , Convert [, SkipLines] , TableDomain [, UndefValueCol1] , Col1NameValue ( coldomainname [ { min : max [ : prec] } ] [, UndefValueCol2] [, Col2Name ( ... ) ] ) ) |
|
||
OUTTABLE |
= |
table(file.ext, Comma | Space | ILWIS14 | DBF , Convert [, SkipLines] , TableDomain [, UndefValueCol1] , Col1NameClassId ( coldomainname [ { Class | ID [ , Extend ] [ , Key ] } [, UndefValueCol2] [, Col2Name ( ... ) ] ) ) |
|
||
OUTTABLE |
= |
table(file.ext, Fixed, Convert [, SkipLines] , TableDomain, WidthCol1 [, UndefValueCol1] , Col1NameValue ( coldomainname [ { min : max [ : prec] } ] [, WidthCol2 [, UndefValue] , Col2Name ( ... ) ] ) ) |
|
||
OUTTABLE |
= |
table(file.ext, Fixed, Convert [, SkipLines] , TableDomain, WidthCol1 [, UndefValueCol1] , Col1NameClassId ( coldomainname [ { Class | ID [ , Extend ] [ , Key ] } [, WidthCol2 [, UndefValueCol2] , Col2Name ( ... ) ] ) ) |
OUTTABLE |
Name of the output table. |
table |
Command line syntax to import a table. |
Comma | Space | ILWIS14 | DBF |
|
|
Parameter to specify the file format of the file to be imported.
|
Fixed |
Parameter to import a file in Fixed format (ASCII, e.g. SDF), i.e. when columns start at fixed positions. Available character positions that are not filled with a character are expected to be filled with a space. |
Convert |
Parameter to specify to convert the file to the ILWIS table data format (.TB#). |
SkipLines |
Optional parameter to specify the number of lines at the beginning of the file that should be skipped when importing. You should use this parameter when the file has a header (e.g. when your file is an ILWIS 1.4 table, the first line should be skipped). |
TableDomain |
Parameter to specify use specify the number
|
WidthCol1 |
Obligatory parameter when importing a file that is in Fixed format.
|
UndefValueCol1 |
Optional parameter to specify, for the first column of the external file, a value which should be regarded as undefined. When encountered in that column during Import, ILWIS will import the specified value as an undefined value, i.e. ?. Similarly, you can specify a value of the second column which should be regarded as an undefined value as UndefValueCol2, etc. |
Col1NameValue |
Parameter to specify a name for the first column. Below, you find the syntax for when this column is supposed to contain values in contrast to classes or IDs. Similarly, you can specify a name for the second column etc. with Col2Name, etc. |
coldomainname |
Parameter to specify a name for the domain of the first column. You can specify both an existing domain name and a new domain name. Tip: When the column is supposed to contain values, you can generally use system domain Value by typing Value for this parameter. Similarly, you can specify a name for the second column etc. with Col2Name, etc. |
min : max [: prec] |
Optionally, when the column is a value column, specify the value range for this column as min : max. Furthermore, you can also optionally specify the precision that should be used by the column as prec. When you know for instance that values of this column are in the range from 0 to 1000 and that 3 decimals are used, type: 0:1000:0.001. All values outside a specified value range will be imported as undefined values. |
Col1NameClassID |
Parameter to specify a name for the first column. Below, you find the syntax for when this column is supposed to contain classes or IDs in contrast to values. Similarly, you can specify a name for the second column etc. with Col2Name, etc. |
coldomainname |
Parameter to specify a name for the domain of the first column. You can specify both an existing domain name and a new domain name.
Tip: Specifying system domain String for columns is a very safe way to import. After import, you can convert the String columns in the imported table to: Finally, you may have to use the Change domain of table operation to convert the table to an attribute table. Similarly, you can specify a name for the second column etc. with Col2Name, etc. |
Class | ID |
Optional parameter to specify whether you wish to put the strings found in this column in a Class domain or in an ID domain.
Parameter can be omitted, when you will accept system naming or when you specified to use the String domain for this column, i.e. as characters only. |
Extend |
Optional parameter to specify whether a Class or ID domain that should be used by this column (coldomainname) should be extended with any new classes or ID's found in the column during import or not.
|
Key |
Optional parameter to specify whether a Class or ID domain that should be used by this column (coldomainname) should be used as the domain of the table. You can use the Key parameter only for 1 (Class or ID) column. The column for which the Key parameter is specified will not appear as a column in the table. Using the Key parameter will overrule any previous setting of the TableDomain parameter. Purpose of this Key parameter: When an output table itself uses a certain Class or ID domain, you can link the output table to a map which uses the same Class or ID domain; the output table will then become an attribute table of the map to which you linked it. You can also link the output table to the Class or ID domain itself; then the table will be the (default) attribute table of all maps which use that domain.
|
Tip:
For more information, please refer to the Import Table wizard.
Examples: |
||
ImpTable1 |
= |
table( HOUSES.DBF, DBF, Convert, none, colAnyname(ImpTable1{ID,Extend,Key}), colHouses(value) ) |
|
Imports the dBase DBF file HOUSES.DBF into ILWIS; a table with the name ImpTable1 will be created. One column in the DBF file will temporarily get the column name colAnyname and it will use domain ImpTable1; this is a new ID domain (therefore Extend) and this temporary column will be used as Key for the output table (i.e. as the domain of the output table). The only column that will thus appear in the output table is called colHouses; this column will use the system Value domain. |
ImpTable2 |
= |
table( HOUSES.DBF, DBF, Convert, none, col1Name(String), col2Houses(String) ) |
|
Imports the dBase DBF file HOUSES.DBF into ILWIS. A table with the name ImpTable2 will be created, the table will use system domain None. The first column in the output table will get column name col1Name and it will use system domain String. The second column in the output table will get column name col2Houses and it will also use system domain String. |
ImpTable3 |
= |
table( SDFTable.SDF, Fixed, Convert, none, 10, col1(String), 25, col2(String) ) |
|
Imports the file SDFTable which is in Fixed format into ILWIS. A table with the name ImpTable3 will be created; the table will have system domain None. The first column in the output table will get column name col1 and it will use system domain String. Col1 will contain the characters that are found on positions 1 to 10 of the input file. The second column in the output table will get column name col2 and it will also use system domain String. Col2 will contain the characters that are found on positions 11 to 35 of the input file. |
export format(ilwobj.ext,filename) |
|
|
Export an ILWIS 3 map or table ilwobj.ext to another data file filename.
arcinfonas | arcinfopts | ascii | bmp | bna | dbase | dbasesdf | delimited | dxf | e00 | erdasgis | erdaslan | ida | idrisi | ilwis2 | ilwis14 | infocam | lin | shapefile | smt | tiff . Furthermore, ILWIS 3 objects which are stored as a table can be exported as tables of external formats: 2-dimensional tables (.ta2), domain class/ID/group (.dom), representation class (.rpr), georeference tiepoints (.grf), coordinate system tiepoints (.csy). Note:
|
arcinfonas |
Export an ILWIS raster map to an Arc/Info non-compressed ASCII file (.ASC). |
arcinfopts |
Export an ILWIS point map to an Arc/Info .PTS (ASCII) file. From this file, (label) points can be created using the Arc/Info Generate command. For format, you may use arcinfopts (as described) or arcgen. |
ascii |
Export an ILWIS raster map to an ILWIS 1.x ASCII file (.ASC). |
bmp |
Export an ILWIS raster map to a Windows bitmap (.BMP). |
bna |
Export an ILWIS segment map to an Atlas vector map (.BNA). |
dbase |
Export an ILWIS table to a dBase III/IV file (.DBF). |
dbasesdf |
Export an ILWIS table to an ASCII dBase III/IV file (.SDF). This format is also known as Standard format or Fixed format. |
delimited |
Export an ILWIS table to an ASCII comma delimited file (.TXT). |
dxf |
Export an ILWIS polygon, segment or point map to an AutoCad .DXF file. |
e00 |
Export an ILWIS polygon, segment or point map to an Arc/Info .E00 file. |
erdasgis |
Export an ILWIS raster map to an Erdas .GIS file; in case you exported a domain Class map, also a trailer file will be created (.TRL). The ILWIS map should preferably be north-oriented. |
erdaslan |
Export an ILWIS map list, which contains multiple bands of a satellite image, or export a single ILWIS raster map to an Erdas .LAN file. The ILWIS map(s) should preferably be north-oriented. |
esriprj |
Export an ILWIS coordinate system projection or an ILWIS coordinate system latlon to an ESRI ArcGIS projection file (.PRJ). An ILWIS coordinate system should have an ellipsoid WGS 84 or an ellipsoid and a datum. |
ida |
Export an ILWIS raster map to an IDA image (.IMG). |
idrisi |
Export an ILWIS raster map to an Idrisi map (.DOC, .IMG). |
ilwis2 |
Export an ILWIS 3 polygon, segment, point map or table to an ILWIS 2 polygon, segment, point map or table (.MPA, .MPS, .MPP, .TBT and others). Histograms or other objects that are stored as a table cannot be exported. |
ilwis14 |
Export an ILWIS raster, segment, point map or table to an ILWIS 1.x raster, segment, point map or table (.MPD, .SEG, .PNT, .TBL and others). Histograms or other objects that are stored as a table cannot be exported. |
infocam |
Export an ILWIS polygon, segment or point map to an InfoCam sequential file (.SEQ). |
lin |
Export an ILWIS segment map to an Arc/Info .LIN file (ASCII). From this file, lines can be created using the Arc/Info Generate command. |
shapefile |
Export an ILWIS polygon, segment or point map to Arc/View Shape files (.SHP, .SHX, .DBF). |
smt |
Export an ILWIS segment map to an ILWIS 1.x ASCII vector file (.SMT). |
tiff |
Export an ILWIS raster map to a Tiff image (.TIF). |
Tip:
For more information, see also the Export dialog box, or the expras.def, expmpl.def, exppol.def, expseg.def, exppnt.def, exptbl.def, expcsy.def files in your ILWIS directory.
Examples: |
|
export e00(water.mps,e00water) |
|
|
Exports the ILWIS segment map WATER.MPS to the file E00WATER.E00 in the Arc/Info interchange format. This example also illustrates the need for the explicit mentioning of the ILWIS map extension: as the E00 export is defined for segments, polygons and points there is no other way than the extension to tell export which type should be exported. |
export erdasgis(soil.mpr,erdsoil) |
|
|
Exports the ILWIS raster map SOIL.MPR to the file ERDSOIL.GIS. If the ILWIS map has a class domain, ILWIS will also create a ERDSOIL.TRL file. |
See also:
How to use parameters in scripts
Appendices : ILWIS expressions
Appendices : ILWIS as DDE server
Import (dialog box)
Export (dialog box)