Esempio n. 1
0
    def _get_raster_value(self, layer, ref, lon, lat):
        if ref in self._rasters:
            raster = self._rasters[ref]
        elif "type" not in layer or layer["type"] == "shp_index":
            raster = GeoRaster(layer["file"])
            self._rasters[ref] = raster
        else:
            raise HTTPInternalServerError(
                'Bad raster type "%s" for raster layer "%s"' %
                (layer["type"], ref))  # pragma: no cover

        result = raster.get_value(lon, lat)
        if "round" in layer:
            result = self._round(result, layer["round"])
        elif result is not None:
            result = Decimal(str(result))

        return result
Esempio n. 2
0
    def _get_raster_value(self, layer, ref, lon, lat):
        if ref in self._rasters:
            raster = self._rasters[ref]
        elif "type" not in layer or layer["type"] == "shp_index":
            raster = GeoRaster(layer["file"])
            self._rasters[ref] = raster
        else:
            raise HTTPInternalServerError(
                'Bad raster type "%s" for raster layer "%s"'
                % (layer["type"], ref))  # pragma: no cover

        result = raster.get_value(lon, lat)
        if "round" in layer:
            result = self._round(result, layer["round"])
        elif result is not None:
            result = Decimal(str(result))

        return result
Esempio n. 3
0
    def _get_raster_value(self, layer, ref, lon, lat):
        if ref in self._rasters:
            raster = self._rasters[ref]
        elif 'type' not in layer or layer['type'] == 'shp_index':
            raster = GeoRaster(layer['file'])
            self._rasters[ref] = raster
        else:
            raise HTTPInternalServerError(
                "Bad raster type '%s' for raster layer '%s'"
                % (layer['type'], ref))  # pragma: no cover

        result = raster.get_value(lon, lat)
        if 'round' in layer:
            result = self._round(result, layer['round'])
        elif result is not None:
            result = Decimal(str(result))

        return result
Esempio n. 4
0
    def _get_raster_value(self, layer, ref, lon, lat):
        if ref in self._rasters:
            raster = self._rasters[ref]
        elif 'type' not in layer or layer['type'] == 'shp_index':
            raster = GeoRaster(layer['file'])
            self._rasters[ref] = raster
        else:
            raise HTTPInternalServerError(
                "Bad raster type '%s' for raster layer '%s'" %
                (layer['type'], ref))  # pragma: no cover

        result = raster.get_value(lon, lat)
        if 'round' in layer:
            result = self._round(result, layer['round'])
        elif result is not None:
            result = Decimal(str(result))

        return result