Table of contents Index

class GvRaster - Raster data object

Declared in module gview

Inheritance hierarchy:

gview.GvRaster
  gview.GvData
    gtk.GtkData

Synopsis

class GvRaster(GvData):
    def gview.GvRaster.__init__(self, filename=None, dataset=None, _obj=None, sample=0, real=1) # Create new raster.
    def gview.GvRaster.data_changed(self, x_off, y_off, width, height) # Send GvData changed signal with a raster rectangle.
    def gview.GvRaster.data_changing(self, x_off, y_off, width, height) # Send GvData changing signal with a raster rectangle.
    def gview.GvRaster.flush_cache(self, x_off=0, y_off=0, width=0, height=0) # Flush data cache.
    def gview.GvRaster.georef_to_pixel(self, x, y) # Translate georeferenced coordinates to pixel/line.
    def gview.GvRaster.get_band(self) # Get GDAL raster band
    def gview.GvRaster.get_dataset(self) # Get GDAL raster dataset
    def gview.GvRaster.get_max(self) # Get the maximum for default scaling
    def gview.GvRaster.get_min(self) # Get the minimum for default scaling
    def gview.GvRaster.get_sample(self, x, y) # Fetch sample value from raster.
    def gview.GvRaster.pixel_to_georef(self, x, y) # Translate pixel/ilne to georeferenced coordinate.

    # Inherited from gtk.GtkObject
    def gtk.GtkObject.__cmp__(self, other)
    def gtk.GtkObject.__getattr__(self, attr)
    def gtk.GtkObject.__getitem__(self, key)
    def gtk.GtkObject.__hash__(self)
    def gtk.GtkObject.__init__(self, _obj=None)
    def gtk.GtkObject.__setitem__(self, key, v)
    def gtk.GtkObject.connect(self, name, f, *extra)
    def gtk.GtkObject.connect(self, name, f, *extra)
    def gtk.GtkObject.connect_after(self, name, f, *extra)
    def gtk.GtkObject.connect_after(self, name, f, *extra)
    def gtk.GtkObject.connect_object(self, name, f, obj, *extra)
    def gtk.GtkObject.connect_object(self, name, f, obj, *extra)
    def gtk.GtkObject.connect_object_after(self, name, f, obj, *extra)
    def gtk.GtkObject.destroy(self, _obj=None)
    def gtk.GtkObject.disconnect(self, id)
    def gtk.GtkObject.emit(self, signal, *args)
    def gtk.GtkObject.emit_stop_by_name(self, sig)
    def gtk.GtkObject.flags(self, mask=None)
    def gtk.GtkObject.get_data(self, key)
    def gtk.GtkObject.remove_data(self, key)
    def gtk.GtkObject.set(self, dict)
    def gtk.GtkObject.set_data(self, key, value)
    def gtk.GtkObject.set_flags(self, flags)
    def gtk.GtkObject.signal_handler_block(self, id)
    def gtk.GtkObject.signal_handler_unblock(self, id)
    def gtk.GtkObject.signal_handlers_destroy(self)
    def gtk.GtkObject.unset_flags(self, flags)

    # Inherited from gview.GvData
    def gview.GvData.__init__(self, _obj=None)
    def gview.GvData.changed(self) # Emit GvData changed signal.
    def gview.GvData.get_name(self) # Fetch the name of this GvData.
    def gview.GvData.get_parent(self) # Fetch parent GvData object.
    def gview.GvData.get_projection(self) # Fetch projection, if any.
    def gview.GvData.get_properties(self) # Get GvData properties (attributes) as a dictionary.
    def gview.GvData.get_property(self, name) # Get a GvData property.
    def gview.GvData.set_name(self, name) # Set the name of this GvData.
    def gview.GvData.set_projection(self, projection) # Set the projection.
    def gview.GvData.set_property(self, name, value) # Set a GvData property.

    # Inherited from gtk.GtkData
    def gtk.GtkData.__init__(self, _obj=None)

gview.GvRaster.__init__(self, filename=None, dataset=None, _obj=None, sample=0, real=1)

Create new raster.

All the arguments of this method are optional, and can be passed as keywords.

filename
name of the file to open. It must be suitable for use with gdal.Open().
dataset
a gdal.Dataset object as returned by gdal.Open(). May be used as an alternative to filename.
sample
Method to use to compute reduced levels of detail. Either gdal.SMAverage (2x2 average) or gdal.SMSample (decimation).
real
The band from the raster file to use as the band.

gview.GvRaster.data_changed(self, x_off, y_off, width, height)

Send GvData changed signal with a raster rectangle.

This signal indicates that a region of the raster has just changed, and will trigger invalidation of any buffered data from the source file, and rereading for display.

x_off
pixel offset to top left corner of change region.
y_off
line offset to top left corner of change region.
width
width of window that is changed.
height
width of window that is changed.

gview.GvRaster.data_changing(self, x_off, y_off, width, height)

Send GvData changing signal with a raster rectangle.

This signal indicates that a region of the raster is about to change, and will trigger capture of an undo memento of the region if undo is enabled.

x_off
pixel offset to top left corner of change region.
y_off
line offset to top left corner of change region.
width
width of window that is changing.
height
width of window that is changing.

gview.GvRaster.flush_cache(self, x_off=0, y_off=0, width=0, height=0)

Flush data cache.

This will cause the data caches of GDAL, and this GvRaster to be cleared out. If this is being done to trigger reload, and redisplay of modified data on disk, then a changed signal should be emitted on the GvRaster instead. This will trigger a flush automatically, and also invalidate displays, forcing them to be rerendered.

x_off
x origin of area to be flushed.
y_off
y origin of area to be flushed.
width
width of area to be flushed (zero for whole image).
height
height of area to be flushed (zero for whole image).

gview.GvRaster.georef_to_pixel(self, x, y)

Translate georeferenced coordinates to pixel/line.

x
X (easting or longitude) in raster layer georeferencing system.
y
Y (northing or latitude) in raster layer georeferencing system.

Returns a (pixel,line) coordinate tuple on the raster.

gview.GvRaster.get_band(self)

Get GDAL raster band

Fetch the band associated with the GvRaster as a gdal.RasterBand object.

gview.GvRaster.get_dataset(self)

Get GDAL raster dataset

Fetch the dataset associated with the GvRaster as a gdal.Dataset object.

gview.GvRaster.get_max(self)

Get the maximum for default scaling

This is computed based on an autoscaling when the GvRaster is first created, and based on 2% tail trim on 10000 sample points.

gview.GvRaster.get_min(self)

Get the minimum for default scaling

This is computed based on an autoscaling when the GvRaster is first created, and based on 2% tail trim on 10000 sample points.

gview.GvRaster.get_sample(self, x, y)

Fetch sample value from raster.

This function will fetch the real, or complex data value at the given location (in raster pixel/line coordinates). If the result is real a single number is returned. It it is complex a (real imaginary) tuple is returned. If the requested point is outside the raster, or if the call fails for some other reason a None is returned.

x
x offset from top left corner of pixel to fetch.
y
y offset from top left corner of pixel to fetch.

gview.GvRaster.pixel_to_georef(self, x, y)

Translate pixel/ilne to georeferenced coordinate.

x
pixel on raster layer (0.0 is left side of leftmost pixel)
y
line on raster layer (0.0 is top side of topmost pixel)

Returns an (x,y) coordinate tuple in the raster georeferencing system.

gview.GvData.changed(self)

Emit GvData changed signal.

Send a notification that this data has changed, with a NULL change_info value.

gview.GvData.get_parent(self)

Fetch parent GvData object.

This is typically used to get the underlying GvData on which a GvLayer (which is also a GvData) depends.

gview.GvData.get_projection(self)

Fetch projection, if any.

The projection is normally expressed in OpenGIS Well Known Text format or an empty string if no value is available.

gview.GvData.get_properties(self)

Get GvData properties (attributes) as a dictionary.

The properties are returned as a Python dictionary. Note that changes to this dictionary are not applied back to the GvData.

gview.GvData.get_property(self, name)

Get a GvData property.

name
the key or name of the property being set. Should be a well behaved token (no spaces, equal signs, or colons).

NOTE: Returns None if property does not exist.

gview.GvData.set_projection(self, projection)

Set the projection.

This method won't actually modify the data geometry, only the interpretation of the geometry.

gview.GvData.set_property(self, name, value)

Set a GvData property.

name
the key or name of the property being set. Should be a well behaved token (no spaces, equal signs, or colons).
value
the value to be assigned. Any text is acceptable.

Valid HTML 4.0! Made with CSS