#6344 closed defect (fixed)

OGR_G_SetPoints behavior is not coherent

Reported by: Ari Jolma Owned by: warmerdam
Priority: normal Milestone: 2.1.0
Component: OGR_SF Version: unspecified
Severity: normal Keywords:
Cc:

Description (last modified by Ari Jolma)

There is no SetPoints_2D function in the C API and the comment in the docs next to z param of SetPoints says that "defaults to NULL for 2D objects".

There are separate SetPoint and SetPoint_2D functions and SetPoint upgrades a 2D point to a 3D point.

SetPoints used on a 2D point upgrades it to 3D point. When it is used on a LineString the behavior depends on stride arguments. If they are zero, the z can be used to force the line string 2D or 3D. If they are not, the line string is always forced to 3D.

I think the coherent behavior should be similar to SetPoint if z is not null and similar to SetPoint_2D if z is null. The doc should say "set to NULL for 2D objects, non-null upgrades the geometry to 3D".

Change History (3)

comment:1 Changed 22 months ago by Ari Jolma

Description: modified (diff)

comment:2 Changed 22 months ago by Ari Jolma

Description: modified (diff)

comment:3 Changed 22 months ago by Even Rouault

Component: defaultOGR_SF
Milestone: 2.1.0
Resolution: fixed
Status: newclosed

Looking at history, this was externally contributed code, and unused in the code base. There were indeed many oddities and I found an extra one related to the particular case of stride == 0 which was not appropriate given the semantics of stride.

Fixed (and tested by) trunk r33290 "OGR_G_SetPoints(): error out if padfX or padfY == NULL, do not change coordinate dimension to 3D when pabyZ == NULL, fix optimization on linestring to call setPoints() only if the strides are the ones of a double, not 0 as incorrectly done before (#6344)"

Note: See TracTickets for help on using tickets.