eoxserver.contrib package¶
Submodules¶
eoxserver.contrib.gdal module¶
This module imports and initializes GDAL; i.e enables exceptions and registers all available drivers.
eoxserver.contrib.gdal_array module¶
eoxserver.contrib.mapserver module¶
eoxserver.contrib.ogr module¶
eoxserver.contrib.osr module¶
eoxserver.contrib.vrt module¶
-
class
eoxserver.contrib.vrt.VRTBuilder(size_x, size_y, num_bands=0, data_type=None, vrt_filename=None)¶ Bases:
objectThis class is a helper to easily create VRT datasets from various sources.
Parameters: - size_x – the pixel size of the X dimension
- size_y – the pixel size of the Y dimension
- num_bands – the initial number of bands; bands can be added afterwards
- data_type – the GDT data type identifier
- vrt_filename – a path the filename shall be stored at; if none is specified the dataset will only be kept in memory
-
add_band(data_type=None, options=None, nodata=None)¶ Add a band to the VRT Dataset.
Parameters: - data_type – the data type of the band to add. if omitted this is determined automatically by GDAL
- options – a list of any string options to be supplied to the new band
-
add_simple_source(band_index, src, src_band, src_rect=None, dst_rect=None)¶ Add a new simple source to the VRT.
Parameters: - band_index – the band index the source shall contribute to
- src – either a
GDAL Datasetor a file path to the source dataset - src_band – specify which band of the source dataset shall contribute to the target VRT band
- src_rect – a 4-tuple of integers in the form (offset-x, offset-y,
size-x, size-y) or a
Rectspecifying the source area to contribute - dst_rect – a 4-tuple of integers in the form (offset-x, offset-y,
size-x, size-y) or a
Rectspecifying the target area to contribute
-
copy_gcps(ds, offset=None)¶ Copy the GCPs from the given
GDAL Dataset, optionally offsetting themParameters: - ds – a
GDAL Dataset - offset – a 2-tuple of integers; the pixel offset to be applied to any GCP copied
- ds – a
-
copy_metadata(ds)¶ Copy the metadata fields and values from the given dataset.
Parameters: ds – a GDAL Dataset
-
dataset¶ Returns a handle to the underlying VRT
GDAL Dataset.
-
classmethod
from_dataset(ds, vrt_filename=None)¶ A helper function to create a VRT dataset from a given template dataset.
Parameters: ds – a GDAL Dataset
-
class
eoxserver.contrib.vrt.VRTBuilder2(size_x, size_y, num_bands=0, data_type=None, vrt_filename=None)¶ Bases:
object-
add_band(data_type=None, options=None, nodata=None)¶
-
add_simple_source(band_index, src, src_band, src_rect=None, dst_rect=None)¶ Add a new simple source to the VRT.
Parameters: - band_index – the band index the source shall contribute to
- src – either a
GDAL Datasetor a file path to the source dataset - src_band – specify which band of the source dataset shall contribute to the target VRT band
- src_rect – a 4-tuple of integers in the form (offset-x, offset-y,
size-x, size-y) or a
Rectspecifying the source area to contribute - dst_rect – a 4-tuple of integers in the form (offset-x, offset-y,
size-x, size-y) or a
Rectspecifying the target area to contribute
-
build()¶
-
build_sources(sources)¶
-
set_geotransform(geotransform)¶
-
warped_gcps(gcp_dsc, resample='NearestNeighbour', order=0)¶
-
-
eoxserver.contrib.vrt.get_vrt_driver()¶ Convenience function to get the VRT driver.
eoxserver.contrib.vsi module¶
This module provides Python file-object like access to VSI files.
-
class
eoxserver.contrib.vsi.TemporaryVSIFile(filename, mode='r')¶ Bases:
eoxserver.contrib.vsi.VSIFileSubclass of VSIFile, that automatically deletes the physical file upon deletion.
-
close()¶ Close the file. This also deletes it.
-
classmethod
from_buffer(buf, mode='w', filename=None)¶ Creates a
TemporaryVSIFilefrom a string.Parameters: - buf – the supplied string
- mode – the file opening mode
- filename – the optional filename the file shall be stored under; by default this is an in-memory location
-
-
class
eoxserver.contrib.vsi.VSIFile(filename, mode='r')¶ Bases:
objectFile-like object interface for VSI file API.
Parameters: - filename – the path to the file; this might also be any VSI special path like “/vsicurl/...” or “/vsizip/...”. See the GDAL documentation for reference.
- mode – the file opening mode
-
close()¶ Close the file.
-
closed¶ Return a boolean value to indicate whether or not the file is already closed.
-
filename¶ Returns the filename referenced by this file
-
read(size=None)¶ Read from the file. If no
sizeis specified, read until the end of the file.Parameters: size – the number of bytes to be read Returns: the bytes read as a string
-
seek(offset, whence=0)¶ Set the new read/write offset in the file.
Parameters: - offset – the new offset
- whence – how the offset shall be interpreted; possible options are
os.SEEK_SET,os.SEEK_CURandos.SEEK_END
-
size¶ Return the size of the file in bytes
-
tell()¶ Return the current read/write offset of the file.
Returns: an integer offset
-
write(data)¶ Write the buffer
datato the file.Parameters: data – the string buffer to be written
-
eoxserver.contrib.vsi.open(filename, mode='r')¶ A function mimicking the builtin function
openbut returning aVSIFileinstead.Parameters: - filename –
the path to the file; this might also be any VSI special path like “/vsicurl/...” or “/vsizip/...”. See the GDAL documentation for reference.
- mode – the file opening mode
Returns: a
VSIFile- filename –
Module contents¶
This package provides a common interface to contributing third party libraries that need some special care when importing or are provided with additional features.