One of the recurring tasks when using GRASS is data import from a non native GRASS format: in this exercise the import of a vector file in the Shape format is shown. The map will be then transformed into a raster and it will be used to create a DTM. First of all download the SHAPE contours.tgz and decompress it in your home directory. Then start from the GRASS menu the command File ->, Import Vector map ->, Import vector data using OGR. The v.in.ogr (the corresponding command on the console) window will open. The program requires the full path to the shape file (already decompressed) to be imported, in this case it should be /home/user-name (replace your user-name), most of the available options should be leaved to their default. Parameters to be specified are: To view the contour level map that has just been created, locate in the GIS layer Manager the button : click on the label Add vector map layer . A window in which it is possible to set all the parameters of the vector map to be displayed will appear. Click and select from the list the contours vector map just created. Check the next image to make sure you have carried out the procedure correctly (it is similar to that used to view a raster map). The height of each contour line of the imported map are stored as attributes and they can be queried directly using the icon on the Map Display and clicking on the contour line: attributes are shown in the Output window of the GIS Layer Manager: Obtaining a raster map from a vector one always implies an approximation. In this case, since linear objects are transformed, a suitable resolution must be set to limit the approximation. First of all, use g.region: Config ->, Region ->, Set region, and select the tab: Resolution. Set the resolution using the field Grid resolution 2D inserting the value 1 (the measurement unit being the meter). Select the tab: Existing and insert in the field Set region to match this vector map the name of the vector map that must be converted into a raster, in our case contours. Once you are done click Run. Now the current region covers the whole contours map with 1 meter resolution. Now, to carry out the conversion, open the v.to.rast window by selecting File ->, Map type conversions ->, Vector to raster. The name chosen for the output map is contours_raster, by checking the first option as shown in the figure, the new created map will be added to the GIS Layer Manager list. Clicking on the tab Attributes it is possible to define the name of the column used to get the height attribute of each line, in our case: level. Click the Run button to start the conversion (if the processing is too slow, set the resolution, as shown above, to 2 meters). If you do not have selected 'Add created map into Layer tree' use contours_raster in Gis Layer Manager to view the raster map (and remove the other maps), as shown beforehand. Depending on the Map Display window size, it could be difficult to see the (raster) contour lines: in this case zoom in. To check the correspondence between vector contour lines and the newly created map, zoom in a small area and overlay the contours vector map to the contours_raster raster map, adding the first one to the Layer Manager (make sure the vector map is on top of the raster one). You should see perfect correspondence. Source.


Яндекс.Метрика Рейтинг@Mail.ru Free Web Counter
page counter
Last Modified: April 18, 2016 @ 3:07 pm