Opened 7 years ago
Closed 7 years ago
#6344 closed defect (fixed)
OGR_G_SetPoints behavior is not coherent
|Reported by:||Ari Jolma||Owned by:||warmerdam|
Description (last modified by )
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 by , 7 years ago
comment:2 by , 7 years ago
comment:3 by , 7 years ago
|Component:||default → OGR_SF|
|Status:||new → closed|
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)"