[Gdal-dev] Problem with Python, OGR/OGDI and VPF.http://www.esri.com/devsupport/devconn/mapobjects/samples/vb/vpfsamples/vpfsamples.zip

Frank Warmerdam warmerdam at pobox.com
Wed Feb 18 14:20:19 EST 2004


Eggert Jón Magnússon wrote:
> I am having problems reading a VPF database through OGDI/OGR in python.
> When I try to call ds.GetLayer(layerCount-2), something locks up.
> I am not sure on which end the lockup is (whether OGR is waiting for OGDI?)
> but ogrinfo displays the layer names correctly.
> 
> The dataset I am using is the formerly publically available sample VPF
> dataset, San Diego Harbor.  (I managed to obtain it from the ESRI homepage:
> http://www.esri.com/devsupport/devconn/mapobjects/samples/vb/vpfsamples/vpfs
> amples.zip)
> 
> Here is the snippet of code that manages to lock up:
> 	for i in range(file.GetLayerCount()):
> 	    layer = file.GetLayer(i)
> 	    print 'layer %s with %d
> features.'%(layer.GetName(),layer.GetFeatureCount())
> 	    gt = layer.GetLayerDefn().GetGeomType()
> 	    print 'gt',gt
> 	    if gt == 3:
> 		obClass = Area
> 		append = self.polygons.append
> 	    elif gt == 2:
> 		obClass = Line
> 		append = self.lines.append
> 	    else: #  gt == 1: Point
> 		obClass = None
> 	    continue
> 
> 
> What happens is that I get a printout of all the layers except the last 2
> ones, and the process locks up.

Eggert,

I just tried the following script with the dataset you referenced, and it
seemed to work fine.

import ogr

file = ogr.Open( 'gltp:/vrf/dnc13cd/H1316010' )


for i in range(file.GetLayerCount()):
     layer = file.GetLayer(i)
     print 'layer %s with %d features.'%(layer.GetName(),layer.GetFeatureCount())
     gt = layer.GetLayerDefn().GetGeomType()
     print 'gt',gt

It ran to completion, and seems to have reported all layers.  The report
ends with:

layer dqyarea at dqy(*)_area with 21 features.
gt 3
layer relline at rel(*)_line with 35 features.
gt 2
layer relpoint at rel(*)_point with 2 features.
gt 1
layer tileref at tileref(*)_area with 2 features.
gt 3
layer libref at libref(*)_line with 270 features.
gt 2

I was doing this on Linux with current CVS versions of OGDI and GDAL/OGR.
What platform are you working on?  What versions of GDAL and OGR?

Now that I am looking at the vrf driver again, I find there are some
leaks which I am digging into, but I can't imagine those would be
responsible for your problems.

Best regards,


---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list