[postgis-users] multiline with with to polygon

pcreso at pcreso.com pcreso at pcreso.com
Fri Jun 3 12:11:19 PDT 2011


Use ST_buffer, as below:

create table mline (gid serial primary key, name varchar(10));
select addgeometrycolumn('','mline','geom',4326,'MULTILINE',2);
insert into mline (name,geom ) values 
('one',setsrid(geometryfromtext((174 -45,175 -44),(174 -44,175 -45)),4326));
insert into mline (name,geom ) values ('two',
setsrid(geomfromtext('MULTILINESTRING((176 -45,176 -44),(173 -44,173 -45))'),4326));
update mline set buff=multi(buffer(geom,0.05));

The result is as in the attached image. It will generate the combined buffer of all the constituent lines in the multiline, NOT the individual buffer zones around each line. If you need all the constituent polygons for each line individually, you'll need to separate them out into separate line features instead of a multiline.

Note that buffering by a distance may require the buffer to be generated in a suitable projection - you can't do it in lat/long), so you may need to transform your multiline to this projection, generate the buffer, & transform it back again

ie: buff=transform(buffer(transform(mline,nnnn)),4326)

HTH,

  Brent Wood
--- On Sat, 6/4/11, Jaime Lop <jaimelop at gmail.com> wrote:

From: Jaime Lop <jaimelop at gmail.com>
Subject: [postgis-users] multiline with with to polygon
To: "PostGIS Users Discussion" <postgis-users at postgis.refractions.net>
Date: Saturday, June 4, 2011, 1:49 AM

Hello everyone,

Is there an easy way to convert multi lines with a width to polygons?

For example, I have a corridor defined as 100 kms around a given line.

Thanks,
Jaime


-----Inline Attachment Follows-----

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110603/1afb39a3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: multi.png
Type: image/png
Size: 9779 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110603/1afb39a3/attachment.png>


More information about the postgis-users mailing list