I've two layers, both with the same fields: A, V, where A is the shape's area and V a value given by me. I want a new layer with shape created by the intersection of the other layers' shapes and a value given by the calculation: (A1*V1+A2*V2)/(A1+A2). Is there a command to make it automatically? Obviously in reality I have many layers with many shapes, otherwise I made it manually.

enter image description here

I used intersection to subdivide all shapes from all layers; in this way for every shapes I have 2 weights (V values). Now I can use vector-field calculator and calculate:($area*("x"+"y"))/(sum(x+y), where x and y are the 2 weights. I hoped there was a command that make it automatically… It's possible at least calculate summation of x and y values in vector-field calculator?


Perhaps the calculator is your answer. From "Raster-Raster Calculator" you can create new layers from others. For the the intersection you can use the "AND".

  • Can I ask you more help? I've not considered raster calculator because I'm working with vector layers, but if it is possbile to do otherwise… How do I access the values A and V? Although riclassify, recovering the V values, but area values? I find no examples or sufficient explanation… – MLuca Feb 28 '15 at 12:09
  • Information about vector-field calculator you can find here docs.qgis.org/2.2/en/docs/training_manual/processing/…. I prefer raster files because it is easier the math algebra. eg. having 2 rasters you can take the intersection perhaps like "raster_new=raster_A AND raster_B"(according to your area). But when you have raster files you have to know that the files must have the same pixel size(you will define this according to your interest) – geo_dd Feb 28 '15 at 12:21
  • Unfortunately vector-field calculator operates on a single layer, but I need to calculate the attributes of shapes of different layers. I have the same terrain that has a value for particular characteristic (in one layer) and another value for another particular characteristic (in another layer). I need a new layer with shapes whose values are obtained as a weighted average of the characteristics. – MLuca Feb 28 '15 at 12:52

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.