Esempio n. 1
0
 def test_absolute_path(self):
     from c2cgeoportal.lib.raster.georaster import GeoRaster
     gr = GeoRaster("c2cgeoportal/tests/data/dem_absolute.shp")
     tile = gr._get_tile(548000, 216000)
     self.assertEqual(tile.filename,
                      "/home/sbrunner/regiogis/regiogis/c2cgeoportal/"
                      "c2cgeoportal/tests/data/dem.bt")
Esempio n. 2
0
 def test_absolute_path(self):
     from c2cgeoportal.lib.raster.georaster import GeoRaster
     gr = GeoRaster("c2cgeoportal/tests/data/dem_absolute.shp")
     tile = gr._get_tile(548000, 216000)
     self.assertEqual(
         tile.filename, '/home/sbrunner/regiogis/regiogis/c2cgeoportal/'
         'c2cgeoportal/tests/data/dem.bt')
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
Esempio n. 5
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. 6
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