Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

In qgis in the raster menu there is an item "convert vector to raster".

This behaves strangely - I do not understand how it is supposed to work.

I can select a vector file, an attribute and an output raster. But, for some reason the output file is only accepted if it exists and even if I select an existing raster nothing seems to happen.

Also I do not understand how the program knows what kind of raster to create, what cell-size, projection etc.

How can I convert vector to raster?

share|improve this question

3 Answers 3

Convert Vector to Raster wraps GDAL's gdal_rasterize, which until version 1.8.0, didn't create the output raster. So the cell size, projection, and so on are determined by the raster not the command line options.

It is something of a Catch-22 for sure because GDAL has no easy method of creating an empty image. You can try creating two one-pixel images for the top left and bottom right in a paint program, run gdal_translate on them to georeference them, then create a VRT from those, and finally use gdal_translate to convert from the VRT to a GeoTIFF or similar, but it is a pain for sure!

The better alternative would be to upgrade to GDAL >= 1.8.0 and use the new -tr and -te parameters of gdal_rasterize.

share|improve this answer
    
Thank you, this works. I updated gdal on ubuntu 11.10 (oneiric) to version 1.9 "unstable". Not so easy, see launchpad.net/~ubuntugis/+archive/ubuntugis-unstable .Then I could get the correct commandline-syntax from qgis raster-menu -> convert -> rasterize. On the linux-commandline I added -tr and -te and got the raster without creating an "empty one" first. –  stn Apr 2 '12 at 23:46

you can also use SAGA GIS (also opensource like QGIS) - there is a tool in Modules/Grid/Gridding/Shapes to grid. I am not familiar with GRASS and the raster tools is QGIS are not enough for me, so I use QGIS together with SAGA and it works very well.

share|improve this answer
    
Checking out saga-gis now. On ubuntu saga version 2.0.8 can be compiled from source (sourceforge.net/projects/saga-gis/files) or version 2.0.7 can be installed as binary from PPA (sourceforge.net/apps/trac/saga-gis/wiki/Binary%20Packages). Apparently most GIS-filetypes have to be imported (see saga-gis-wiki). In that matter QGIS is a bit better because it opens most gis-files natively without conversion. But, if the tools of saga-gis are better that is certainly a good argument for saga-gis. –  stn Apr 3 '12 at 9:11
    
First impression: The tools-collection is Huge :-) –  stn Apr 3 '12 at 9:32
    
holy crap this thing is hard to install on a mac –  boulder_ruby 2 days ago

if you are arcgis user you can do this with Feature to Raster tool.

ArcToolbox > Conversion Tools > To Raster > Feature to Raster

from dialog box, do following instructions.

The vector dataset
The field to assign values to features
The output raster name and location
The cell size for the output raster dataset

i hope it helps you

share|improve this answer
    
Yes, I know. Unfortunately no arcgis available here, too expensive for me :-) GRASS has these functions too, but I find QGIS sooo much easier to handle. –  stn Apr 2 '12 at 23:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.