1

I have a problem converting a shapefile to raster.

I created a point-shapefile using a text-table with some xyz-coordinates. Now I want to convert it into a tiff, where all the areas without values (everything except the points) get the value 0.

When I use the tool "rasterize" I can only decide for one attribute (x, y or z) with a black box without any values as output. What am I doing wrong?

1

You only get the choice of a single value because that is all that a raster (normally) can hold. I presume you want to create a DEM from your XYZ data, so for the attribute, pick Z. QGIS will then calculate the value of the cells of the raster based on the location of the points (you will have used the x and Y values when you converted from csv to shapefile). Now this is where you need to make a decision:

If you know that your points represent a regular grid of contiguous cells, then set the resolution of your raster to match (e.g. if you know the csv has points with a spacing of 10m x10m, then you set the horizontal and vertical resolution to these values). This is your simplest use-case.

If your csv represents sample points, then you will need to use a different tool because you will need to interpolate the data 'in the gaps'. There are many different interpolation methods and which one you need will depend on your data and would really be the subject of a separate question. I'm guessing you want the previous method.

Once you have created your raster, double check that you have data. The output might LOOK black, but that could be just because no statistics have been calculated on it. Go to the style tab of the layer properties and you'll see a tool to calculate statistics (which are used for rendering the image) on the right hand side of the dialog. Set 'extent' to full and accuracy to 'actual', then click load.

  • Thank you very much for your reply! It´s just some sample points. Is there a possibility that the `data gaps´ get the value 0 ? - What I want to do is to get one more new raster afterwards which contains the differences between the measured points and the DEM. Thanks, Andreas – Andreas Müller Nov 3 '15 at 10:57
  • If it is sample points then, yes, the gaps will all be given the value of null data. You need to interpolate. Check this site and you will find a lot of questions on the subject of interpolation and which methods to use. – MappaGnosis Nov 4 '15 at 8:12
  • Thanks so far. Sadly the output of the "rasterize" function is always a sqare without any values / only 0.... – Andreas Müller Nov 10 '15 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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