Ejemplo n.º 1
0
def gdalconst_to_imagemode(const):
    """
    This function translates a GDAL data type constant as defined in the
    :mod:`gdalconst` module to a MapScript image mode constant.
    """
    if const == gdal.GDT_Byte:
        return MS_IMAGEMODE_BYTE
    elif const in (gdal.GDT_Int16, gdal.GDT_UInt16):
        return MS_IMAGEMODE_INT16
    elif const == gdal.GDT_Float32:
        return MS_IMAGEMODE_FLOAT32
    else:
        raise InternalError(
            "MapServer is not capable to process the datatype '%s' (%d)." %
            gdal.GetDataTypeName(const), const)
Ejemplo n.º 2
0
    def build(self):
        from lxml.builder import E
        from lxml import etree
        root = E("VRTDataset",
                 *[
                     E("VRTRasterBand",
                       *self.build_sources(band["sources"]),
                       dataType=gdal.GetDataTypeName(band["data_type"]),
                       band=str(i))
                     for i, band in enumerate(self.bands, start=1)
                 ],
                 rasterXSize=str(self.size_x),
                 rasterYSize=str(self.size_y))
        #root.append()

        if self.transformer:
            gcp_ds, resample, order = self.transformer
            root.append(
                E("GDALWarpOptions", E("WarpMemoryLimit", "6.71089e+07"),
                  E("ResampleAlg", resample)))
        return etree.tostring(root, pretty_print=True)
Ejemplo n.º 3
0
 def __unicode__(self):
     return "%s (%s)" % (self.name, gdal.GetDataTypeName(self.data_type))