Merge pull request #771 from pierotofy/cogeo

Increase hillshade value, bilinear filtering on DSM/DTM
pull/778/head
Piero Toffanin 2019-12-11 15:55:36 -05:00 zatwierdzone przez GitHub
commit 3fb8315d12
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 13 dodań i 13 usunięć

Wyświetl plik

@ -214,13 +214,7 @@ class Metadata(TaskNestedView):
return Response(info)
def get_elevation_tiles(url, x, y, z, indexes, tilesize, nodata):
resampling = "bilinear"
padding = 16
elevation, _ = main.tile(url, x, y, z, indexes=indexes, tilesize=tilesize, nodata=nodata,
resampling_method=resampling, tile_edge_padding=padding)
def get_elevation_tiles(elevation, url, x, y, z, tilesize, nodata, resampling, padding):
tile = np.full((tilesize * 3, tilesize * 3), nodata, dtype=elevation.dtype)
try:
@ -317,14 +311,20 @@ class Tiles(TaskNestedView):
if z < minzoom - ZOOM_EXTRA_LEVELS or z > maxzoom + ZOOM_EXTRA_LEVELS:
raise exceptions.NotFound()
resampling="nearest"
padding=0
if tile_type in ["dsm", "dtm"]:
resampling="bilinear"
padding=16
try:
if expr is not None:
tile, mask = expression(
url, x, y, z, expr=expr, tilesize=tilesize, nodata=nodata, tile_edge_padding=0, resampling_method="nearest"
url, x, y, z, expr=expr, tilesize=tilesize, nodata=nodata, tile_edge_padding=padding, resampling_method=resampling
)
else:
tile, mask = main.tile(
url, x, y, z, indexes=indexes, tilesize=tilesize, nodata=nodata, tile_edge_padding=0, resampling_method="nearest"
url, x, y, z, indexes=indexes, tilesize=tilesize, nodata=nodata, tile_edge_padding=padding, resampling_method=resampling
)
except TileOutsideBounds:
raise exceptions.NotFound("Outside of bounds")
@ -360,7 +360,7 @@ class Tiles(TaskNestedView):
# Hillshading is not a local tile operation and
# requires neighbor tiles to be rendered seamlessly
elevation = get_elevation_tiles(url, x, y, z, indexes, tilesize, nodata)
elevation = get_elevation_tiles(tile[0], url, x, y, z, tilesize, nodata, resampling, padding)
intensity = ls.hillshade(elevation, dx=dx, dy=dy, vert_exag=hillshade)
intensity = intensity[tilesize:tilesize*2,tilesize:tilesize*2]

Wyświetl plik

@ -251,8 +251,8 @@ export default class LayersControlLayer extends React.Component {
<div className="col-sm-9 ">
<select className="form-control" value={hillshade} onChange={this.handleSelectHillshade}>
<option value="0">None</option>
<option value="3">Normal</option>
<option value="6">Extruded</option>
<option value="6">Normal</option>
<option value="18">Extruded</option>
</select>
</div>
</div> : ""}

Wyświetl plik

@ -97,7 +97,7 @@ class Map extends React.Component {
let metaUrl = url + "metadata";
if (type == "plant") metaUrl += "?formula=NDVI&bands=RGN&color_map=rdylgn";
if (type == "dsm" || type == "dtm") metaUrl += "?hillshade=3&color_map=jet";
if (type == "dsm" || type == "dtm") metaUrl += "?hillshade=6&color_map=jet";
this.tileJsonRequests.push($.getJSON(metaUrl)
.done(mres => {