[Gdal-dev] extent of a file/map [2]

Frank Warmerdam warmerdam at pobox.com
Wed Jul 28 16:16:30 EDT 2004


Fulko van Westrenen wrote:
> Frank,
> 
> Thank you for your reply. I tried some code, but it does not behave as
> expected:
>   File "./mooring65.gtk.py", line 846, in load_objects
>       feat = objects.GetNextFeature()
>   File "/usr/lib/python2.3/site-packages/ogr.py", line 383, in GetNextFeature
>     return Feature( obj = f_o )
> TypeError: a float is required

Fulko,

Sorry, I have no idea why you are getting the above exception with the
following code.  Your approach seems reasonable.  I gather you do get the
extent?

> A snippet of the offending code:
> 
> def load_objects(dataset,name,sumloc):
>     try:
>        objects=dataset.GetLayerByName( name )
>     except:
>        return sumloc
>     if objects is not None:
>        extent = objects.GetExtent(0)
>        print extent
>        feat = objects.GetNextFeature() #this is the line that generates the error
>        while feat is not None:
>           geom=feat.GetGeometryRef()
> 
> I inserted objects.ResetReading() after the print instruction, but
> that didn't help much. I have the feeling I do not understand the
> behaviour of osr. Any help is much appreciated.
> 
> Thanks,
> Fulko
> 										    
> 
> 


-- 
---------------------------------------+--------------------------------------
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