TransWikia.com

Convex hull that follows irregular points distribution

Geographic Information Systems Asked by Gery on January 10, 2021

Based on an irregular distribution of points (longitude,latitude), I obtained the convex hull below (I use saga_cmd with polygon convexity in 1). Would you have a way to create a convex hull that closely follows this irregular shape using one-liner commands or similar? I call commands from a bash terminal in Linux.

enter image description here

One Answer

Using PostGIS ST_ConcaveHullyou may get the envelope to follow more closely the irregular shape, as stated in your post;

ogr2ogr -f GPKG concave.gpkg points.gpkg -nln concave_layer -dialect sqlite -sql "select 'a', ST_ConcaveHull(st_collect(geometry),0.9) from points_layer"

A few remarks:

  1. You are using a point layer, so if you call st_concave_hull directly on your geometry it will try to make a polygon for each point, which will return empty geometries, so first we call st_collect(geometry);

  2. The layer name in the sql query can be retrieved with ogrinfo file.gpkg, it is often not the same name as the layer.

  3. For some functions to work in ogr2ogr you need a non-geometry field, that's why I passed 'a' to the command, here it works without it.

  4. It is an expensive algorithm, to test it you may use a subset of your layer passing where fid < 1000 to the query

Correct answer by Elio Diaz on January 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP