Opened 16 years ago

Last modified 16 years ago

#85 closed task (fixed)

ST_Distance crashes on Circular String

Reported by: robe Owned by: robe
Priority: medium Milestone: PostGIS 1.4.0
Component: postgis Version: 1.4
Keywords: Cc:

Description

What steps will reproduce the problem?

  1. SELECT ST_Distance(ST_GeomFromText('CIRCULARSTRING(220268 150415,220227

150505,220227 150406)'), ST_Point(220268, 150415))

What is the expected output? Unsupported or a number

What do you see instead? Crashes server

This occurs on 1.3.3 and 1.3.5SVN (not verified on 1.4) so long standing issue.

Change History (5)

comment:1 by mcayland, 16 years ago

The initial backtrace on this one points to an infinite recursion, but due to lack of time for testing, I think this is going to have to wait until after 1.3.5 :(

ATB,

Mark.

comment:2 by mcayland, 16 years ago

Yup, it seems to be getting stuck somewhere in lwgeom_mindistance2d_recursive_tolerance. Anyone with CircularString knowledge able to work out what is supposed to be happening here?

ATB,

Mark.

comment:3 by mcayland, 16 years ago

Right, looking closer at the source code it's fairly obvious why this is falling over

  • the complete set of distance2d_curve_*() and distance2d_*_curve() functions are

missing from measures.c!

Anyone know how to measure distance from a curve? Looking at lwgeom_curvepolygon_area() in the same file, it appears as if we should segmentize the curve into 32 linear sections and use that…

ATB,

Mark.

comment:4 by mcayland, 16 years ago

Quick fix applied to SVN trunk and 1.3 branch - i.e. we detect the CIRCULARSTRING and throw an 'Unsupported geometry type' error rather than crashing. The code for calculating distance from a CIRCULARSTRING would require quite a bit of work, and should only be added in 1.4 (trunk).

Regina, feel free to enable the CIRCULARSTRING tests once again in your garden XSL generator once you are happy that this works.

ATB,

Mark.

comment:5 by mcayland, 16 years ago

AFAICT the tests all pass with this in place, and so I'm moving it to fixed.

ATB,

Mark.

Note: See TracTickets for help on using tickets.