3

Inside a graphical modeller with several other steps, I need to use single-sided buffers on two occasions: once to shrink polygon outputs by 10m (right-side buffer, 10m) and once to identify neighbouring features (left-side buffer, 15m, then extract by location). All other parameters are the same: segments = 8, joint style = round, miter limit = 2 (which shouldn't play a role). Polygons are turned into lines before undergoing buffering.

The single-sided buffer is yielding unclean outputs on both cases. The outputs should be single polygons representing wide agricultural fields.

Here are examples with WKT:

MultiPolygon (((761290.55600291 5397119.93779837, 761288.37771173 5397094.33679718, 761286.4905407 5397099.96109228, 761286.44932978 5397100.08137143, 761258.21105602 5397180.82065931, 761251.04103306 5397202.65935422, 761250.9727217 5397202.86020501, 761199.27707636 5397349.72783339, 761149.88004231 5397491.24933346, 761137.52221247 5397526.60751653, 761178.17481603 5397534.0862517, 761181.21544118 5397525.57661718, 761199.75788368 5397472.92807561, 761199.87636975 5397472.60908095, 761238.65939456 5397373.40040641, 761251.94506958 5397335.34331186, 761267.32084159 5397290.09404124, 761298.34023974 5397194.76735341, 761318.01669458 5397134.22705693, 761297.88882594 5397128.73763821, 761300.52 5397119.09, 761290.55600291 5397119.93779837)))

enter image description here

MultiPolygon (((761606.44 5397765.09, 761555.56121323 5397891.6208191, 761555.56121323 5397891.6208191, 761606.44 5397765.09)),((761546.39588804 5397895.65984857, 761545.77800232 5397895.91756047, 761545.34 5397898.17, 761546.39588804 5397895.65984857)),((761597.16242995 5397761.3581514, 761648.43225105 5397633.89870516, 761639.76017978 5397627.36921212, 761606.27088452 5397608.6760964, 761551.52783887 5397744.79118025, 761496.9532908 5397880.50197161, 761524.20608748 5397883.89668968, 761524.87881404 5397884.00386894, 761546.18025755 5397888.1460808, 761597.16242995 5397761.3581514)))

enter image description here

MultiPolygon (((762630.05150548 5397774.65541669, 762630.05150548 5397774.65541669, 762632.9 5397765.72, 762630.05150548 5397774.65541669)),((762616.51901469 5397817.10536458, 762616.51901469 5397817.10536458, 762629.99329387 5397774.83802015, 762616.51901469 5397817.10536458)),((762642.34088709 5397768.34836332, 762642.34088709 5397768.34836332, 762633.03 5397765.31, 762642.34088709 5397768.34836332)),((762642.5369688 5397768.41234943, 762642.5369688 5397768.41234943, 762779.02 5397812.95, 762642.5369688 5397768.41234943)),((762775.91775957 5397822.45663475, 762639.50015014 5397777.94033286, 762626.02594422 5397820.20744747, 762762.39191815 5397864.70326009, 762899.31956418 5397909.37979592, 762912.92158111 5397867.15802502, 762775.9181488 5397822.45676176, 762779.02 5397812.95, 762775.91775957 5397822.45663475)))

enter image description here

Here is a link to a zipped file of my polygon shapefile and here is a link to the MODEL3 file for the complete graphical model (both saved in Google Drive). I couldn't paste it in my post because it exceeds the character limit.

If it helps, I have pasted the MODEL3 script to my complete graphical model below.

How could I fix this?

10
  • 1
    Could you add some problematic geometries as WKT?
    – user30184
    Commented Jun 8, 2023 at 16:18
  • 1
    @user30184 of course. I edited my post with the information. Commented Jun 8, 2023 at 16:49
  • 1
    Would you mind sharing your shapefile? At first glance I'd suspect that you have some "invisible" geometries that you were not aware of in the original shapefile. Something similar to this Q&A.
    – Binx
    Commented Jun 8, 2023 at 17:49
  • 3
    I do not understand how you can use single sided buffer for polygons. The tool description is "This algorithm buffers lines by a specified distance on one side of the line only."
    – user30184
    Commented Jun 8, 2023 at 19:02
  • 1
    The inside buffer case is probably using something similar than postgis.net/docs/ST_Buffer.html "By default end caps are square" but you wrote you used round. However, I would buffer the polygon by -10 meters and then take the difference (original-buffered). The neighboring features can be selected directly with "select within distance", buffering is unnecessary.
    – user30184
    Commented Jun 9, 2023 at 7:35

1 Answer 1

2

This is not an answer to how to make a clean buffer polygon for a closed linestring with the single sided buffer function. Instead of using single side buffer, I suggest to use a normal buffer function with a negative buffer distance. By subtracting this shrunk polygon from the original geometry you can get the desired result.

When it comes to finding features within some distance, it is unnecessary to buffer the geometries and then find the intersecting geometries. The QGIS function "Select within distance" can find the features directly

Select within distance

This algorithm creates a selection in a vector layer. Features are selected wherever they are within the specified maximum distance from the features in an additional reference layer.

Search by buffering is one of the "bad queries" example in this PostGIS blog http://blog.cleverelephant.ca/2021/05/indexes-and-queries.html.

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.