1

I know that you can have an on-the-fly transformation on a layer when rendering on the canvas, but is there a way to run a tool like Buffer where the layer should be re-projected on-the-fly just before buffering? For example, I have points in WGS84 but I want to buffer them in the linear unit of a specific national grid, or perhaps of the project default CRS.

I have looked around online for this but it is difficult to find any sources which are not referring to the normal "on-the-fly" transformations used when rendering the layer on the canvas.

3
  • 2
    QGIS documentation states that "The numerical values have to be defined in map units according to the Coordinate Reference System (CRS) used with the data."
    – Erik
    Feb 2, 2021 at 14:20
  • Right-click layer / Export /Save features as... and set the CRS you want to use for buffering. By the way: what QGIS-version do you use?
    – Babel
    Feb 2, 2021 at 14:27
  • @Babel, that's what I'm already doing which is why I was hoping that there was a more streamlined way. Version is 3.10.
    – wfgeo
    Feb 2, 2021 at 14:35

1 Answer 1

3

You can do that applying geometry generator and first transform from WGS84 to a projected CRS, applying the buffer in meters and than transform back to WGS84. See my case:

  • Project CRS: 3857 (WebMercator)
  • Layer CRS: 4326 (WGS84)
  • CRS used for buffering: 2056 (projected CRS used for Switzerland)

Use this expression in geometry generator to get a buffer of 100 meters (buffer measured in 2056, converted to 4326, transformed "on-the-fly" to 3857):

transform (
    buffer (
        transform (
            $geometry, 
            'epsg:4326',
            'epsg:2056'
        ), 
        100
    ),
    'epsg:2056',
    'epsg:4326'
)

Screenshot: Point layer in EPSG:4326, Project CRS in EPSG:3857, buffer applyied in EPSG:2056: enter image description here

The same buffers visualized with Project CRS in EPSG 4326: enter image description here

And the same setting with Project in EPSG 2056: enter image description here

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.