Opened 10 years ago

Closed 10 years ago

#5325 closed defect (invalid)

GetGeometryType() returns wrong number for 2D line

Reported by: ustroetz Owned by: hobu
Priority: normal Milestone:
Component: PythonBindings Version: 1.10.1
Severity: normal Keywords:
Cc:

Description

Adding points to a line with AddPoint returns wrong number. It works fine with AddPoint_2D. Is that supposed to be like that?

>>> from osgeo import ogr
>>> line = ogr.Geometry(ogr.wkbLineString)
>>> line.AddPoint(1116651.439379124, 637392.6969887456)
>>> line.AddPoint(1188804.0108498496, 652655.7409537067)
>>> 
>>> print line.GetGeometryType()
-2147483646
>>> print line.GetGeometryName()
LINESTRING
>>> 
>>> 
>>> line = ogr.Geometry(ogr.wkbLineString)
>>> line.AddPoint_2D(1116651.439379124, 637392.6969887456)
>>> line.AddPoint_2D(1188804.0108498496, 652655.7409537067)
>>> 
>>> print line.GetGeometryType()
2
>>> print line.GetGeometryName()
LINESTRING
>>>

Change History (2)

comment:1 by ustroetz, 10 years ago

Version: unspecified1.10.1

comment:2 by Even Rouault, 10 years ago

Resolution: invalid
Status: newclosed

AddPoint() adds implicitely a Z coordinate to 0 if it is not specified. Hence GetGeometryType() reports ogr.wkbLineString | ogr.wkb25DBit = -2147483646

Note: See TracTickets for help on using tickets.