[postgis-users] MakeLine into new layer
Shane Carey
careyshan at gmail.com
Tue Oct 23 06:29:51 PDT 2018
Thanks Brent, but it keeps returning a error message:
ERROR: column "id" does not exist LINE 2: SELECT id, ^ HINT: There is a
column named "id" in table "long_lines", but it cannot be referenced from
this part of the query. SQL state: 42703 Character: 31
Thanks
Le gach dea ghui,
*Shane Carey*
*GIS and Data Solutions Consultant*
On Mon, Oct 22, 2018 at 8:26 PM Brent Wood <pcreso at yahoo.com> wrote:
>
> 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_lines*
>
>
>
>
>
> *SELECT 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 Carey*
> *GIS 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/20181023/0648727c/attachment.html>
More information about the postgis-users
mailing list