2

I'm trying to find out how the buffer command in the filed calculator works. I tried to create a new field to my point shapefile (integer) with the following:

buffer ($geometry, 100)

but no geometries are added to the canvas and the filed in the table in empty. The $geometry attribute should refer to a specific field of the shapefile or not?

Someone has successfully used this function?

2 Answers 2

4

The field calculator cannot be used in that way. If you want to create buffers, use the buffer tool from the vector menu.

The buffer function and other geometry functions in the field calculator can be used for calculations but not to create new geometries/features. For example to check if the features intersect a certain geometry:

 intersects( buffer ($geometry ,100), geomFromWKT( some_WKT_here ) )

will return true/false.

1
  • Ok, but I cannot understand what should appear in the new field of the table after running the buffer function. Maybe the value of the buffer area for each geometry?
    – matteo
    Commented Apr 9, 2014 at 16:59
-2

I think the most likely use of such functions would be to calculate the area of the buffer. Something like:

area(buffer ($geometry ,100))

which does not exist, however.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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