[postgis-users] Problem with a zero length line

Michael Fuhr mike at fuhr.org
Fri Sep 22 21:51:06 PDT 2006


On Fri, Sep 22, 2006 at 04:43:14PM -0600, Bruce Rindahl wrote:
> select AsText(Intersection(
> LineFromText('LINESTRING(1 0.5,2 0.5)'),
> PolyFromText('POLYGON((0 0,1 0,1 1,0 1,0 0))')
> ))
> 
> Result:
> "POINT(1 0.5)"
> 
> While this is technically correct, I think the result should be:
> "LINESTRING(1 0.5,1 0.5)" 
> 
> Note this result is a valid geometry and returns a length of 0.

IsValid() doesn't think that geometry is valid:

test=> SELECT IsValid(LineFromText('LINESTRING(1 0.5,1 0.5)'));
NOTICE:  Too few points in geometry component at or near point 1 0.5 0.5
 isvalid 
---------
 f
(1 row)

I don't know if the following is applicable or if the document is
still in use, but The OpenGIS Abstract Specification: An Object
Model for Interoperable Geoprocessing, Revision 1 (96-015R1) has
the following among the assertions for line strings (3.15.3.2):

  1. Each line must have at least 2 distinct vertexes, each represented
     by a coordinate in the sequence.

  2. 'Degenerate' one point lines should use point structures.

  4. Sequential vertexes should be distinct.  Repeated (sequential)
     vertexes are ignored and discouraged with extreme prejudice.

  6. A line string (with 4 or more vertices) may be self-intersecting.

Can anybody more familiar with current standards comment?

-- 
Michael Fuhr



More information about the postgis-users mailing list