[postgis-users] Fw: MakeLine into new layer

Brent Wood pcreso at yahoo.com
Mon Oct 22 12:30:23 PDT 2018



     
Off the top of my head...
That returns the longest straight line within a polygon. 

I suggest your workflow is to create a target table first (with a column for the id of the polygon it came from), so you have somewhere to put the linestrings (not necessary, but I find it tidier).
eg:
create table long_lines (id integer primary key), geom  geometry(LINESTRING, <SRID>);
then run your query...
INSERT INTO long_linesSELECT id,  
   ST_MakeLine(St_LongestLine(
    (SELECT geom FROM floodplainw
    WHERE id = 1),
    (SELECT geom FROM floodplainw
    WHERE id = 1))
); 

Cheers
Brent Wood

      From: Shane Carey <careyshan at gmail.com>
 To: postgis-users at lists.osgeo.org 
 Sent: Tuesday, October 23, 2018 8:07 AM
 Subject: [postgis-users] MakeLine into new layer
  
Hi,I am trying to find the longest line of a polygon and insert it into a new line. I can create the makeline as in the code below but cannot create a new layer out of it using the INTO keyword. Any help would be appreciated. Thanks
SELECT 
   ST_MakeLine(St_LongestLine(
    (SELECT geom FROM floodplainw
    WHERE id = 1),
    (SELECT geom FROM floodplainw
    WHERE id = 1))
);

Le gach dea ghui,
Shane CareyGIS and Data Solutions Consultant
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users

   

   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20181022/92bead3a/attachment.html>


More information about the postgis-users mailing list