Opened 10 years ago

Closed 10 years ago

Last modified 8 months ago

#435 closed defect (fixed)

2d/3d overlay fails elevating all vertices

Reported by: strk Owned by: strk
Priority: major Milestone: 3.3.0
Component: Default Version: main
Severity: Content Keywords:
Cc:

Description

Intersection between these two lines

LINESTRING(0 0,0 10,10 10,10 0)
LINESTRING(10 10 4,10 0 5,0 0 5)

Results in a collection of a 3d point and a 2d line.

ElevationMatrix? should instead be engaged to elevate everything.

Change History (8)

comment:1 Changed 10 years ago by strk

Owner: changed from geos-devel@… to strk
Status: newassigned

comment:2 Changed 10 years ago by strk

ElevationMatrix? is doing the right thing. I suspect the problem depends on a geometry's getCoordinateDimension

comment:3 Changed 10 years ago by strk

Ok, problem is CoordinateSequence::getDimension which is using a cached 'dimension' member and not updating it after filtering.

Should be fixable by either avoiding the cache or properly maintaining it.

The caching code was introduced here:

commit ecffbba56f92f454dcdd8d5542c890439718a676
Author: warmerdam <warmerdam@5242fede-7e19-0410-aef8-94bd7d2200fb>
Date:   Mon May 31 16:25:57 2010 +0000

    Attempt to make geometry dimension perform more smoothly.
    Modified CoordinateArraySequence to default to unknown dimension (0), which
    is determined at the point getDimension() is called by examination of the
    first coordinate Z (ISNAN test).  The WKTWriter has also been altered to
    write 0.0 instead of nan, and to avoid writing "Z" for EMPTY geometries.(#348)
    
    
    git-svn-id: http://svn.osgeo.org/geos/trunk@2998 5242fede-7e19-0410-aef8-94bd7d2200fb

@FrankW : willing to take a look yourself ?

comment:4 Changed 10 years ago by strk

Clearing the cache in CoordinateArraySequence::apply_rw seems to fix it effectively.

comment:5 Changed 10 years ago by strk

Resolution: fixed
Status: assignedclosed

r3278 fixes by clearning the "dimension" cache in ::apply_rw

comment:6 Changed 10 years ago by strk

I dubt the cache makes sense, btw, as the way dimension is computed is by looking at a single Coordinate anyway, which doesn't take all that time...

comment:7 Changed 10 years ago by warmerdam

The dimension variable is used primarily so that at creation time the dimension can be set explicitly. For instance, it should be legal to have a geometry with all zero "Z" values but still having dimension 3 *or* 2.

I think it would be more appropriate for apply_rw() to reset a dimension of 2 to 3 if any of the filtered vertices have a non-NAN, non-zero Z coordinate after processing.

comment:8 Changed 8 months ago by Sandro Santilli <strk@…>

In 2ad9efe/git:

Port ElevationModel? class from JTS

Closes #1070

Differences from JTS:

Note1:

Using CoordinateFilter? instead of CoordinateSequenceFilter?
allows CoordinateSequence? to clear the dimension cache which
would otherwise not properly set the sequence as having Z
(see #435)

Note: See TracTickets for help on using tickets.