I have a point and buffered it using st_buffer. How do I create a polygon geometry from that buffered point? The result of st_buffer is the polygon I need to save for future use.

I will be placing the new geometry in the geometry column of an existing table (created specifically for this purpose) and use the id of the point as the foreign key to link it back to the original point. Potentially, there may be multiple buffers for each point so point's id will not be the rows PK.

The destination table will look something like this...

CREATE TABLE geom_buffered_pts
  oid bigserial NOT NULL,
  point_id bigserial NOT NULL,
  geom geometry,
  CONSTRAINT geom_buffered_pts_pk PRIMARY KEY (oid)
  • Do you want to create a new table, or a new geometry column for the polygons you just created (and keep the point geometry column) or replace the point geometry column with the polygon geometry column? – DPSSpatial Dec 1 '15 at 22:30
  • @mapBaker I updated the question. – DenaliHardtail Dec 1 '15 at 23:47

Easiest way:

CREATE TABLE geom_buffered_pts AS (
  SELECT point_id,
  ST_Buffer(geom, 100)
  FROM table

Then you can add your OID bigserial, constraints and foreign key later, explicitly. You could of course continue with what you have and just use an update query, with SET geom = ST_Buffer(geom, 100) to update the geometry with the buffered points, or using SELECT INTO. (Note I've only used the value of 100 for illustration, and you'll want to ensure your data is projected).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.