0% found this document useful (0 votes)
186 views7 pages

SHP 2 Grid

This document provides documentation for a plugin that converts vector shapefile data (polygons, lines, or points) to raster grid data. The plugin requires MapWindow GIS software and has been tested with versions 4.4 and 4.5. It uses scanline and Bresenham algorithms to rasterize polygons and lines. The documentation describes how to install the plugin, use it to select a shapefile and properties for the output grid, and display the results. The plugin is free software distributed under the Mozilla Public License.

Uploaded by

Sachin Khandare
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
186 views7 pages

SHP 2 Grid

This document provides documentation for a plugin that converts vector shapefile data (polygons, lines, or points) to raster grid data. The plugin requires MapWindow GIS software and has been tested with versions 4.4 and 4.5. It uses scanline and Bresenham algorithms to rasterize polygons and lines. The documentation describes how to install the plugin, use it to select a shapefile and properties for the output grid, and display the results. The plugin is free software distributed under the Mozilla Public License.

Uploaded by

Sachin Khandare
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

1.

MapWindow Shapefile to Grid Plugin


(version 1.1 documentation) Ji Kadlec, 4.June 2008 The Shapefile to grid plugin can be used for the conversion of vector data (polygons, lines or points) to raster (grid) data. This conversion is often referred to as rasterization. In the raster map, the whole area of interest is represented as a matrix of small squares or rectangles (also called pixels). The raster representation is suitable for displaying continuous quantities (rainfall, temperature, elevation,..) Many hydrological and other simulation models (WASIM-ETH, Modflow..) use square grids as the main input and output data format. Overlaying raster maps is also a simple mathematical operation.

1.1

Software Requirements

The plugin requires MapWindow GIS software which can run on Microsoft Windows operating system (98, 2000, XP, Vista). This plug-in has been tested with MapWindow 4.4 and 4.5. Speed of computation depends on computer memory and the size and complexity of the processed shapefile.

1.2

Installation

Copy the file ShapefileToGrid.dll to the MapWindow\Plugins\ directory. This directory is often located in C:\Program Files\MapWindow\Bin\Plugins

1.3

Using the plugin

1.3.1 Start MapWindow and select the plugin


Start MapWindow. First, go to Plugins in the main menu and select Edit Plugins. In the list of available plugins, Shapefile to Grid should be shown. Select Shapefile to Grid and click Apply. A new Icon will be shown on the main MapWindow toolbar. Click on the icon. A first form will be shown.

1.3.2 Choose a shapefile


The Shapefile to grid form has two selection boxes. In the first box, the shapefile which should be converted to grid can be selected. Use a loaded layer will use one of the shapefiles that are displayed on the MapWindow map. Use a file from Disk option can be used to choose a shapefile which isnt displayed as a MapWindow layer. In the second box Select the attribute field for grid cell values a list of possible fields that contain data is displayed. The fields are columns in the attribute table of the shapefile. Only numeric fields are shown. The values of the selected field will be used as result grid values.

Click the Next.. button to continue.

1.3.3 Choose result grid properties


The second form is used to specify how the result grid should look like. The following four properties can be selected: Grid Cell size, Extent, Data type and File type.

1) Grid Cell Size This is the size of the grid square pixel. Currently, only square pixels are supported. The Grid cell size should be in the same units as the current map units. The current map units are specified by the current project projection. In most cases, the units are meters. There are two options how to choose the grid cell size: a) Same as an existing grid this option is only enabled if there is a grid layer loaded in MapWindow. Choose this option when you want to overlay the newly created grid with an existing grid in your future analysis. b) As specified below Enter the cell size of the new grid. The cell (grid pixel) size should be in the map units of the current project.

2) Grid Extent The grid extent is defined by the Y and Y coordinates of the upper right and lower left corner of the grid. Depending on the number of layers displayed in the current MapWindow project, there will one or more options how to choose the grid extent: a) Same as an existing shapefile or grid This option is enabled if there is a shapefile of a grid layer loaded in MapWindow. When chosing this option, the maximum and minimum X and Y values of the new grid will be the same as the maximum and minimum X and Y values of the selected grid or shapefile. b) As specified below This is the last option in the list. Enter the minimum X, maximum X, minimum Y and maximum Y of the new grid.

Figure 1 Grid extent and cell size

Select grid extent same as existing shapefile

Select grid extent user specified values 3) Grid Data Type Four different data types can be selected: ShortDataType (Short integer, 2 Bytes), LongDataType (Long integer, 4 Bytes), FloatDataType (floating-point precision, 4 Bytes) and DoubleDataType (double precision, 8 Bytes). The selection of grid data type will affect the size of the resulting grid file. 4) Grid File Type Supported output grid formats are ASCII Grid (text file), USU Binary grid and GeoTiff (binary files). For a detailed description of the formats, please see the following links: ASCII Grid (.txt, .asc) http://en.wikipedia.org/wiki/ESRI_grid#ASCII GeoTiff (.tiff) http://geotiff.maptools.org/spec/contents.html USU Binary (.bgd) This is a binary grid format used by MapWindow. For format description, see http://www.mapwindow.org/phorum/read.php?4,8597,8615#msg-8615 5) Grid file name Use the (Browse..) button to choose the path and file name of the new grid. After chosing the file name, click the Finish button on the main form. A message showing selected result grid properties will be displayed and calculation will start.

Message showing the values of grid properties

1.3.4 Display the results


After clicking OK, a message Calculation will start! will be shown. The progress of calculation will be shown in the progress bar. If the grid was successfully created, the Grid Calculation Finished message is displayed.

Choose Yes if you want to add the new grid to the map in the current project. If you want to display it later, choose No.

1.3.5 Note on displaying grids in MapWindow


If the new grid is later added to MapWindow using the Add layer button, the shading is displayed by default. This will cause incorrect display of grids created from line shapefiles by the Shapefile to Grid plugin. Right-click on the grid, select Coloring Scheme Edit.. and make sure the Compute Hillshade checkbox is unchecked.

1.4

Algorithms used by the plugin

The Shapefile to Grid plugin uses the Scanline polygon fill algorithm for rasterizing polygons and the Bresenham line algorithm for rasterizing lines. For more information about the scanline algorithm, go to http://www.cs.rit.edu/~icss571/filling/ (Polygon fill teaching tool, department of computer sciences, Rochester Institute of Technology) For more information about the Bresenham http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm algorithm, see

1.5

Authors of the Shapefile to Grid Plugin

The original source code of the plugin (polygon rasterization) was written by Enrico Chiaradia (UNIMI, Italy). It was modified by Ji Kadlec (Czech Republic) who added line rasterization and created the user interface. For more information, error reports or improvement suggestions, please contact Ji Kadlec at [email protected].

1.6

License

The "Shapefile to grid" plugin is free software. The software binary file and source code are subject to the Mozilla Public License Version 1.1 (the "License"); You may not use this software except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

You might also like