[postgis-users] Creating touching depth areas from gridded data

Roxanne Reid-Bennett rox at tara-lu.com
Thu Feb 4 14:09:33 PST 2016


On 2/3/2016 10:34 AM, Hemant Bist wrote:
> ...
> I tried the simple approach of st_union grid rectangles with 
> st_snap_to_grid as mentioned here 
> <http://gis.stackexchange.com/questions/31895/what-is-the-best-way-to-join-lots-of-small-polygons-to-form-a-larger-polygon>.
> The problem is that the resulting polygons have zig-zag edges. If I do 
> st_simplify or smoothening (grass v.generalize) I am left with 
> polygons that are not touching anymore (there is a gap between 
> polygons that were touching earlier).
>

There are those on this list that have a LOT more experience using all 
the tools, but I'll provide some observations...

You might get a single query to give you what you really want, but it is 
likely you will need to do the transformation in steps. Because you are 
massaging polygons, you may end up with a Topology exception given 
specific data.  Recognize it might happen and decide how you will handle 
it. We ended up using almost exclusively user defined functions to do 
transforms by steps and not a single query.

ST_SnapToGrid takes in varying precision on the radius.  0.0001 will not 
give the same result as 0.000001.
ST_Buffer can be used to grow or shrink a polygon by a set amount - but 
if you grow each polygon, you'll then have overlaps that have to be 
trimmed.

It might be possible to SnapToGrid, then grow one polygon in a group and 
let it grab all the space it overlaps with the other polygons by using 
ST_Difference and ST_Intersects to trim the polygons you will take space 
from - but that presumes you are "OK" with the degradation in precision 
of the size of each polygon...  is this for display or analytics?

Roxanne

-- 
[At other schools] I think the most common fault in general is to teach students how to pass exams instead of teaching them the science.
Donald Knuth

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160204/42c7261d/attachment.html>


More information about the postgis-users mailing list