[postgis-devel] st_isvalid linestring and multilinestring

Martin Davis mbdavis at refractions.net
Mon Mar 1 09:37:23 PST 2010


JTS reports both of these as invalid, because of the LineString which 
has only a single effective point.

I think this is according to the letter of the SFS spec, but you could 
argue that they are being too restrictive....  Since it's easy to check 
for this case, you could argue that single-point linestrings should just 
be treated like points.

Although... topologically speaking a point geometry is completely 
different to a linear geometry, which is probably where this rule came 
from.  They were probably thinking more about what made sense from a 
topological point of view, rather than what might be convenient from a 
"let's deal with dirty data" viewpoint.

strk wrote:
> Check this out:
>
> strk=# select st_isvalidreason('MULTILINESTRING((20 20, 20 20))');
>               st_isvalidreason
> ---------------------------------------------
>  Too few points in geometry component[20 20]
> (1 row)
>
> strk=# select st_isvalidreason('MULTILINESTRING((0 0, 10 0),(20 20, 20 20))');
>  st_isvalidreason
> ------------------
>  Valid Geometry
> (1 row)
>
> Interesting, isn't it ?
> Martin, does JTS check for lines in a multilinestring being valid ? 
>
>
> --strk;
>
>   ()   Free GIS & Flash consultant/developer
>   /\   http://foo.keybit.net/~strk/services.html
>   

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022




More information about the postgis-devel mailing list