Ejemplo n.º 1
0
    def convert(self, obj, gateway_client):
        name = obj.value

        if name == 'NearestNeighbor':
            sample = JavaClass("geotrellis.raster.resample.NearestNeighbor$", gateway_client)
        elif name == 'Bilinear':
            sample = JavaClass("geotrellis.raster.resample.Bilinear$", gateway_client)
        elif name == 'CubicConvolution':
            sample = JavaClass("geotrellis.raster.resample.CubicConvolution$", gateway_client)
        elif name == 'CubicSpline':
            sample = JavaClass("geotrellis.raster.resample.CubicSpline$", gateway_client)
        elif name == 'Lanczos':
            sample = JavaClass("geotrellis.raster.resample.Lanczos$", gateway_client)
        elif name == 'Average':
            sample = JavaClass("geotrellis.raster.resample.Average$", gateway_client)
        elif name == 'Mode':
            sample = JavaClass("geotrellis.raster.resample.Mode$", gateway_client)
        elif name == 'Median':
            sample = JavaClass("geotrellis.raster.resample.Median$", gateway_client)
        elif name == 'Max':
            sample = JavaClass("geotrellis.raster.resample.Max$", gateway_client)
        elif name == 'Min':
            sample = JavaClass("geotrellis.raster.resample.Min$", gateway_client)
        else:
            raise TypeError(name, "Could not be converted to a GeoTrellis ResampleMethod.")

        return sample.__getattr__("MODULE$")
Ejemplo n.º 2
0
    def convert(self, object, gateway_client):
        JavaRasterizerOptions = JavaClass("geotrellis.raster.rasterize.Rasterizer$Options$", gateway_client)
        if (object.sampleType == 'PixelIsPoint'):
            sample = JavaClass("geotrellis.raster.PixelIsPoint$", gateway_client)
        elif (object.sampleType == 'PixelIsArea'):
            sample = JavaClass("geotrellis.raster.PixelIsArea$", gateway_client)
        else:
            raise TypeError("Could not convert {} to geotrellis.raster.PixelSampleType".format(object.sampleType))

        sample_instance = sample.__getattr__("MODULE$")
        return JavaRasterizerOptions().apply(object.includePartial, sample_instance)