3

I made this polygon by creating a scratch layer and tracing out the outside points (see image below) grouping the points nearest to each other.

enter image description here

However, tracing out the points will take time for me, I tried different methods to generate polygon automatically, but they don't look promising to me.

This is by clustering then concave hull with threshold = 0.01 close but still not what result that I want. enter image description here

This is by buffer : rectangular and dissolve. The edges are too sharp and I have to regularly change the "distance" to fit that there will be no holes inside.

enter image description here

This is from cluster, then minimum bounding geometry.

enter image description here

3
  • 1
    The block in the lower left can make trouble for algorithms. Could you consider separating that from the rest of the data?
    – user30184
    Mar 27, 2023 at 10:08
  • 1
    Did you try Smooth tool? Mar 27, 2023 at 10:18
  • 3
    Try really fine tuning the alpha parameter of Concave hull. I tried on a similar point data set and 0.025 was to small but 0.03 gave a good result
    – BERA
    Mar 27, 2023 at 10:19

2 Answers 2

4

You can use Spatialite and create a Virtual Layer:

First the query will cross join all points to themselves if there is a point within 45 meters of another and create lines between them:

enter image description here

and then polygonize and unary union the polygons: enter image description here

You need a column named id with unique values integer values, and replace points with the name of your point layer. Adjust 45 m to just include the closest 8 points, see last screenshot.

select a.id, b.id, st_UnaryUnion(polygonize(makeline(a.geometry, b.geometry))) as geometry
from points a
join points b
on ptdistwithin(a.geometry, b.geometry, 45)
and a.id<b.id

enter image description here

2
  • This is way too advance for my level. Although. I tried and gave me an error : Error executing SQL: Error executing SQL select a.id, b.id, st_UnaryUnion(polygonize(makeline(a.geometry, b.geometry))) as geometry from points a join points b on ptdistwithin(a.geometry, b.geometry, 45) and a.id<b.id: There was an error opening GPKG dbname='file:///C:/Users/CMCA/Downloads/20230327_CDC_BOKA-copy.csv?type=csv&maxFields=10000&detectTypes=yes&xField=Easting&yField=Northing&crs=USER:100000&spatialIndex=no&subsetIndex=no&watchFile=no'! Execution failed after 0.06 seconds
    – charliey
    Mar 28, 2023 at 7:18
  • If your layer is a delimited text layer I suggest you export it to a proper point layer in shapefile or geopackage format
    – BERA
    Mar 28, 2023 at 7:28
3

You can consider the "Cluster DBSCAN" tool, which assign a cluster number to each point within a giving distance of each other.

Then, you can use "minimum bounding geometry",specifying the ID_CLUSTER attribute created with the cluster DBScan to regroup entities.

3
  • Thanks for this , however in "min bounding geom' it did not work
    – charliey
    Mar 27, 2023 at 13:49
  • I changed the above applying your suggestions. concave hull is the closest I think .. but is there other options for this? thank you very much
    – charliey
    Mar 28, 2023 at 6:29
  • I don't see other options in this tool. An other way, could be to apply a Buffer on your Cluster DBScan result ; and then Dissolve the layer by joining on the CLUSTER_ID attribute... and try different options with simplify tools.
    – sallib
    Mar 28, 2023 at 10:27

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .