Operations: Polygon to raster map

From ILWIS
Jump to: navigation, search
Main Page Arrow.png Operations
Polygon to raster map
Polygon to raster

The Polygon to raster map operation rasterizes a polygon map. The class names, IDs, or values in the polygon map are also used in the raster map, i.e. the domain of the polygon map is also the domain of the raster map. For the output raster map, an existing georeference has to be selected or a new one can be created. The georeference determines the number of lines and columns of the output map and the pixel size of the map. It is strongly advised that vector maps of the same area are rasterized on the same georeference: any map calculation or spatial operation performed later on a combination of raster maps will only make sense if the pixels in these maps refer to the same area on the ground. When a polygon map has an attribute table or when the domain of the polygon map has an attribute table, the Polygons to raster map operation automatically links this attribute table to the output raster map. At the moment it is not yet possible to rasterize a polygon map with a value domain into a raster map which is stored using 8 bytes per pixel. In that case it is advised to set the value range of the output raster map in such a way that the raster map can be stored with 1, 2, or 4 bytes per pixel. To obtain frequency information on polygons, you can calculate the histogram of a polygon map with the Histogram operation.
The Polygon to raster map operation can be applied via ILWIS-Python editor or via ILWIS Main window, Toolbar and the Operatins tab. The required Python syntax is:


name of the output raster coverage = ilwis.Engine.do(name of the operation, name of the input feature coverage, name of the target georeference)


Then, the Python syntax for the above mentioned operation is:


output raster = ilwis.Engine.do("polygon2raster", “file:///C:/my director/my feature coverage”, “file:///C:/mydirector/my georeference)


In general, the URL used in the Python syntax can be replaced with variable name created via using Python. For example: you can open a feature coverage and a georeference as variables and give them a name as the following example:


fc = ilwis.FeatureCoverage("file:///C:/my director/my feature coverage.mpa") georef = ilwis.GeoReference("file:///C:/my director/my georef.grf")


Once these variable is created via ILWIS-Python editor, then they can be used directly in Python syntax without quotation mark and the path as the following:


output = ilwis.Engine.do("polygon2raster", fc, georef)

Figure 1, Polygon to raster operation form



To start the Polygon to raster map operation from ILWIS main window:

Mar.jpg
  • Click the Operation tab on toolbar tabs
  • From the opened operation list select Polygon to raster map

Once the Polygon to raster map operation is selected from the list, an operation form will be opened in which you can set parameters required for that operation including input(s), output(s), memory location and data format (Figure 1).

To successfully execute this operation, you need to complete the form with proper inputs data. The inputs data must be dragged from the catalog and dropped in their corresponding fields in the form or typed in.

input feature coverage: Select an input feature coverage to be rasterized.
input georeference: Select an existing georeference for the output raster map(s) to which the input map(s) should be rasterized.
output raster coverage: Type a name for the output raster map that will contain rasterized pixels.
Output format: Select a format to save the output raster map. The default format is Memory; if you select it, the output will be temporally saved in the internal catalog and will be removed when you exit the program. If you select other format, the output will be saved in the active catalog.
Execute: Click the Execute button to run this operation.