Buffering points
Here is a post in buffering points and combining them using GeomUnion. Works in GEOS3.0.0, so note that your POSTGIS installation in windows contains a lower version of GEOS.
DROP FUNCTION combineGeometry(); CREATE FUNCTION combineGeometry() RETURNS Void AS' DECLARE --define datatypes here updateCount integer DEFAULT 0; geom_record RECORD; geom_current RECORD; geom_final RECORD; mytotal integer DEFAULT 0; BEGIN --get the total SELECT count(*) as mycount FROM busstopv1_buffer_20_temp INTO mytotal; -- 1,2,3,4,5 FOR geom_record IN SELECT * FROM busstopv1_buffer_20 LOOP --get the current geom of the record SELECT * FROM busstopv1_buffer_20_temp b WHERE b.gid = geom_record.gid INTO geom_current; RAISE INFO ''RECORD GID: %'', geom_record.gid; RAISE INFO ''===========TOTAL COUNT: %=============='', mytotal; --find the intersection of the current geom with other spatial entities --and loop through that. For each loop, update the geom. IF geom_current IS NULL THEN CONTINUE; END IF; FOR geom_final IN SELECT GeomUnion(b0.the_geom, geom_current.the_geom ) AS geom_current_union, b0.gid FROM busstopv1_buffer_20_temp b0 WHERE b0.gid <> geom_current.gid AND Intersects(b0.the_geom, geom_current.the_geom) = ''t'' ORDER BY gid ASC LOOP --geom_current.gid = geom_record.gid UPDATE busstopv1_buffer_20_temp SET the_geom = GeomUnion( the_geom, geom_final.geom_current_union ) WHERE gid = geom_current.gid; RAISE INFO ''UPDATED GID:%'', geom_current.gid; DELETE FROM busstopv1_buffer_20_temp WHERE gid = geom_final.gid; RAISE INFO ''DELETED GID:%'', geom_final.gid; mytotal = mytotal - 1; END LOOP; END LOOP; END;' LANGUAGE plpgsql; SELECT combineGeometry(); |
Next step.. trying out CGAL.