Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2491 closed defect (invalid)

GetGeometryType does not work on geometries retrieved from a VRT data source

Reported by: jbronn Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: 1.5.2
Severity: normal Keywords: vrt geometrytype
Cc:

Description

Given a VRT file (test.vrt):

<OGRVRTDataSource>                                                                                                                                      
<OGRVRTLayer name="test">                                                                                                                               
<SrcDataSource relativeToVRT="1">test.csv</SrcDataSource>                                                                                               
<GeometryType>wkbPoint</GeometryType>                                                                                                                   
<GeometryField encoding="PointFromColumns" x="POINT_X" y="POINT_Y" z="NUM"/>                                                                            
</OGRVRTLayer>                                                                                                                                          
</OGRVRTDataSource>  

With the following CSV data set (test.csv):

POINT_X,POINT_Y,NUM                                                                                                                                     
1.0,2.0,5                                                                                                                                               
5.0,23.0,17                                                                                                                                             
100.0,523.5,23

Any geometry pulled from this VRT data source will have an invalid geometry type number. This script demonstrates the problem:

from osgeo import ogr

ds = ogr.Open('test.vrt')
lyr = ds[0]
for feat in lyr:
    geom = feat.geometry()
    print geom.GetGeometryType(), geom.GetGeometryName()

The script produces the following output:

-2147483647 POINT
-2147483647 POINT
-2147483647 POINT

Change History (2)

comment:1 Changed 12 years ago by Even Rouault

Resolution: invalid
Status: newclosed

Actually, I don't think there is any problem. It just returns the (signed) integer corresponding to ogr.wkbPoint25D = 0x80000001. And as you defined a 'z' column, this result is consistant.

>>> print ogr.wkbPoint25D
-2147483647

comment:2 Changed 12 years ago by jbronn

Cc: jbronn@… removed

My bad, thanks for the clarification.

Note: See TracTickets for help on using tickets.