5

I'm a new user of Quantum GIS (1.7.3) and I need to repeat a task multiple times, so I'm wondering if there is a quicker way to do the following (with three or more polygon layers - each layer has a single polygon):

  1. Union
  2. Dissolve
  3. Buffer

The effect will be to have three separate single-polygons shapefiles merged into one (larger) single polygon shapefile, with a buffer around it.

Answers in PostGIS would be useful too as my data is stored there. Thanks!

Edit: Adding PostGIS information

The multiple polygons I want to Union-Dissolve-Buffer are the result of a catchment basin point table that I've created in PostGIS, converted (in R) to an alpha-hull (i.e. concave hull) polygon shapefile using the CRAN alphahull package. To create the original catchment table in PostGIS, for example, I do this:

CREATE TABLE catchment_10304 as
select 
    id,
    geom_4269,
    (select sum(cost) from (
       SELECT * FROM shortest_path('
       SELECT gid AS id,
          start_id::int4 AS source,
          end_id::int4 AS target,
          newcost::float8 AS cost
       FROM network',
       10304,
       id,
       false,
       false)) as foo ) as cost
from node;

CREATE TABLE catchment1_10304 AS 
SELECT * FROM catchment_10304 WHERE cost < 1364;

Then I do it for three different nodes (representing the boundaries of a region). To create the total catchment area for the region, I want to Union-dissolve-buffer with the three or more individual catchment area tables.

4
  • 2
    Pretty similar to this question gis.stackexchange.com/questions/20344/… Commented Mar 6, 2012 at 9:51
  • If you post your create table statements, we can work on a PostGIS answer.
    – underdark
    Commented Mar 6, 2012 at 17:26
  • I posted the PostGIS table creation, but I convert them to a polygon alphahull before combining. If I could do the alphahull-polygon conversion in PostGIS that would simplify things.
    – baha-kev
    Commented Mar 6, 2012 at 19:10
  • You can do alpha shapes in PostGIS if you install pgRouting: underdark.wordpress.com/2011/09/25/…
    – underdark
    Commented Mar 6, 2012 at 21:10

1 Answer 1

2

You can try something like this:

WITH unioned AS
(
SELECT id, ST_Union(geom_4269) AS geom, cost FROM catchment_10304
    GROUP BY id, cost
)
SELECT id, ST_ConcaveHull(geom, 0.8), cost FROM unioned

First we union the shapes each into a single multipoint (the group by allows us to keep the original fields), then we use ST_ConcaveHull (http://postgis.net/docs/ST_ConcaveHull.html) to create a concave hull.

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.