[Gdal-dev] ogrlayer GetExtent implemented yet?
Frank Warmerdam
warmerdam at pobox.com
Mon Oct 6 18:29:40 EDT 2003
Tyler Mitchell wrote:
>
>
>
> In the ogr.py that I've got, I see that layer.GetExtent() says "not
> implemented yet". Is there an alternative already available for extents on
> layers or does it just mean I need to do a bit more work?
Tyler,
I have just implemented the GetExtent() method for the Python OGR wrapper. It
is now in CVS. You can just copy this in place of the existing GetExtent()
in ogr.py:
def GetExtent( self, force = 1 ):
extents = _gdal.ptrcreate( 'double', '', 4 )
res = _gdal.OGR_L_GetExtent( self._o,
_gdal.ptrcast(extents,'OGREnvelope_p'), force )
if res != 0:
ret_extents = None
else:
ret_extents = ( _gdal.ptrvalue( extents, 0 ),
_gdal.ptrvalue( extents, 1 ),
_gdal.ptrvalue( extents, 2 ),
_gdal.ptrvalue( extents, 3 ) )
_gdal.ptrfree( extents )
return ret_extents
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