[postgis-users] Create LINESTRING with a LOOP

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Mon Apr 23 08:19:23 PDT 2007


On Mon, 2007-04-23 at 15:00 +0000, paallen at attglobal.net wrote:
> Mark,
> 
> Thanks for your suggestion.  After pouring over
> the documentation more I gave up on starting with
> a null linestring and just put a IF THEN in to
> check for the 1st & 2nd points.  Below was my fix.
> 
> But actually I started off using a large text
> string, then feeding it into the EWKT all at once
> and that is where I ran into problems.  Which is
> why I then tried to build up the line using
> geometries incrementally.
> 
> This script was just a really simplified example
> of what I need to do.  My real function is looping
> through a series of records (<100-200) containing
> distances &  orientations along a curved line and
> calculating coordinates for a from/to (begin/end)
> distance (using Minimum Curvature Alogrithm that I
> have written in pl/pgsql).  And it appears that
> for really long LINESTRINGS it craps out.  If I
> run the function returning just a  text string of
> the coordinates, the coordinates look fine.  But
> when I convert them to a LINESTRING it returns
> nothing.  If I reduce the length, or number of
> nodes, it works.
> 
> So now the question is, "Is there a limit to the
> number of nodes in a LINESTRING?" ?  
> 
> I cannot believe so but it is the only solution
> that I can think of.
> 
> Phil


Hi Phil,

AFAIK there aren't any restrictions on LINESTRING lengths. FWIW the
example I posted earlier still works here for 1024 points, and even
16384 points (albeit very slowly). Can you remind us of which versions
of PostgreSQL/PostGIS you are using?

SELECT version(); SELECT postgis_full_version();


Many thanks,

Mark.





More information about the postgis-users mailing list