199 lines
4.7 KiB
Markdown
199 lines
4.7 KiB
Markdown
# Creazione MbTiles per tileserver GL utilizzando Copernicus glo30
|
||
|
||
## Download dei file
|
||
|
||
🚀 Scaricare i dati da mirror Copernicus GLO‑30
|
||
```
|
||
aws s3 sync s3://copernicus-dem-30m ./glo30 --no-sign-request
|
||
```
|
||
Crea glo30 dir con tutto il mondo
|
||
|
||
ma non servono tutti i dati quindi questi sono i tre programmi python per
|
||
scaricare italia europa e mondo in base a quello che vuoi ottenere
|
||
|
||
```
|
||
python3 i.py # italia
|
||
python3 e.py # europa
|
||
python3 w.py # mondo
|
||
```
|
||
|
||
## Trasformare i DEM geotiff in tiff RGB
|
||
|
||
con la funzione rgbify_batch.py puoi creare le versioni tif in formato RGB
|
||
|
||
```
|
||
python3 rgbify_batch.py glo30_italia glo30_italia_rgb
|
||
```
|
||
|
||
il comando per la singola tiff sarebbe
|
||
|
||
```
|
||
rio rgbify -b -10000 -i 0.1 a.tif a_rgb.tif
|
||
```
|
||
|
||
## Trasformare gli RGB in tiles
|
||
|
||
corretto
|
||
```
|
||
python3 make_tiles_rio_tiler.py glo30_italia_rgb/Copernicus_DSM_COG_10_N46_00_E011_00_DEM_rgb.tif tiles_x
|
||
```
|
||
|
||
## Trasformare i tiles in mbtiles
|
||
|
||
```
|
||
mb-util --scheme=xyz --image_format=png tiles_x/ x.mbtiles
|
||
```
|
||
|
||
## Inserire i metadata in mbtiles
|
||
|
||
```
|
||
python3 set_mbtiles_metadata.py glo30_italia_rgb/Copernicus_DSM_COG_10_N46_00_E011_00_DEM_rgb.tif xxx.mbtiles "Terrain RGB Adamello"
|
||
```
|
||
|
||
## Verificare
|
||
|
||
```
|
||
python3 verify_mbtiles_metadata.py glo30_italia_rgb/Copernicus_DSM_COG_10_N46_00_E011_00_DEM_rgb.tif xxx.mbtiles
|
||
python3 verify_and_fix_mbtiles.py glo30_italia_rgb/Copernicus_DSM_COG_10_N46_00_E011_00_DEM_rgb.tif xxx.mbtiles
|
||
python3 verify_bounds_tileservergl.py glo30_italia_rgb/Copernicus_DSM_COG_10_N46_00_E011_00_DEM_rgb.tif xxx.mbtiles
|
||
```
|
||
|
||
## multipli
|
||
|
||
multili con file
|
||
```
|
||
python3 make_tiles_rio_tiler.py glo30_italia_rgb/Copernicus_DSM_COG_10_N46_00_E011_00_DEM_rgb.tif tiles_m
|
||
python3 make_tiles_rio_tiler.py glo30_italia_rgb/Copernicus_DSM_COG_10_N46_00_E010_00_DEM_rgb.tif tiles_m
|
||
|
||
mb-util --scheme=xyz --image_format=png tiles_m/ m.mbtiles
|
||
|
||
python3 set_mbtiles_metadata_multi.py glo30_italia_rgb/Copernicus_DSM_COG_10_N46_00_E011_00_DEM_rgb.tif glo30_italia_rgb/Copernicus_DSM_COG_10_N46_00_E010_00_DEM_rgb.tif m.mbtiles
|
||
```
|
||
|
||
|
||
multipli con dir
|
||
```
|
||
python3 make_tiles_rio_tiler_multi.py dir_tif tiles_mm
|
||
mb-util --scheme=xyz --image_format=png tiles_mm/ mm.mbtiles
|
||
python3 set_mbtiles_metadata_dir.py dir_tif mm.mbtiles
|
||
```
|
||
|
||
ultima idea
|
||
```
|
||
python3 make_tiles_rio_tiler.py glo30_italia_rgb/Copernicus_DSM_COG_10_N46_00_E010_00_DEM_rgb.tif tiles_x
|
||
python3 make_tiles_rio_tiler.py glo30_italia_rgb/Copernicus_DSM_COG_10_N46_00_E011_00_DEM_rgb.tif tiles_y
|
||
rsync -av tiles_x/ tiles_m/
|
||
rsync -av --ignore-existing tiles_y/ tiles_m/
|
||
mb-util --scheme=xyz --image_format=png tiles_m/ m.mbtiles
|
||
python3 set_mbtiles_metadata_dir.py dir_tif m.mbtiles
|
||
scp m.mbtiles orangepi@192.168.1.4:/home/nvme/dockerdata/tileserver1/terrain.mbtiles
|
||
```
|
||
|
||
funzionante
|
||
```
|
||
python3 dir_to_terrainrgb_mbtiles1.py \
|
||
dir_tif \
|
||
prova.mbtiles \
|
||
--min-zoom 5 --max-zoom 14 \
|
||
--bbox 9.999,45.999,12.001,47.001 \
|
||
--tilesize 256 --threads 8 \
|
||
--buffer 2
|
||
```
|
||
|
||
## Controllo
|
||
|
||
|
||
Monte Adamello
|
||
|
||
Latitude: 46° 9' 19" N
|
||
Longitude: 10° 29' 47" E
|
||
Lat/Long (dec): 46.1554,10.4966
|
||
Köppen climate type: ET : Tundra
|
||
Elevation: 3,539m
|
||
|
||
elevazione=-10000+(R*256^2+G*256+B)*0,1
|
||
|
||
estrarre l'altezza del monte dal geotiff
|
||
```
|
||
gdallocationinfo -wgs84 -valonly glo30_italia/Copernicus_DSM_COG_10_N46_00_E010_00_DEM.tif 10.4966 46.1554
|
||
```
|
||
è da come risultato
|
||
|
||
3496.90673828125
|
||
|
||
estrarre l'altezza del monte dal rgb
|
||
```
|
||
gdallocationinfo -wgs84 glo30_italia_rgb/Copernicus_DSM_COG_10_N46_00_E010_00_DEM_rgb.tif 10.4966 46.1554
|
||
```
|
||
|
||
e da come report
|
||
```
|
||
Report:
|
||
Location: (1788P,3041L)
|
||
Band 1:
|
||
Value: 2
|
||
Band 2:
|
||
Value: 15
|
||
Band 3:
|
||
Value: 57
|
||
```
|
||
utilizzando la funzione python che calcola altutudine da RGB si ottiene 3496.90
|
||
```
|
||
python3 rgb2alt.py 2 15 57
|
||
```
|
||
|
||
verifichiamo con mbtiles
|
||
|
||
```
|
||
gdallocationinfo -wgs84 -valonly \
|
||
-b 1 -b 2 -b 3 \
|
||
aa.mbtiles 10.4966 46.1554
|
||
```
|
||
|
||
```
|
||
gdallocationinfo -wgs84 -valonly \
|
||
-b 1 -b 2 -b 3 \
|
||
x.mbtiles 10.4966 46.1554
|
||
```
|
||
|
||
Punta Penia
|
||
|
||
Dolomiti (3.343 m), sono approssimativamente:
|
||
|
||
Latitudine: 46° 26' 03.84" N (46.43429)
|
||
|
||
Longitudine: 11° 50' 58.58" E (11.85051)
|
||
```
|
||
gdallocationinfo -wgs84 -valonly glo30_italia/Copernicus_DSM_COG_10_N46_00_E011_00_DEM.tif 11.85051 46.43429
|
||
3236.89526367188
|
||
gdallocationinfo -wgs84 glo30_italia_rgb/Copernicus_DSM_COG_10_N46_00_E011_00_DEM_rgb.tif 11.85051 46.43429
|
||
Report:
|
||
Location: (3062P,2037L)
|
||
Band 1:
|
||
Value: 2
|
||
Band 2:
|
||
Value: 5
|
||
Band 3:
|
||
Value: 16
|
||
python3 rgb2alt.py 2 5 16
|
||
3236.800000000001
|
||
gdallocationinfo -wgs84 -valonly -b 1 -b 2 -b 3 x.mbtiles 11.85051 46.43429
|
||
2
|
||
6
|
||
68
|
||
python3 rgb2alt.py 2 6 68
|
||
3267.6
|
||
```
|
||
|
||
|
||
gdallocationinfo -wgs84 -valonly \
|
||
-b 1 -b 2 -b 3 \
|
||
aa.mbtiles 10.4966 46.1554
|
||
2
|
||
15
|
||
147
|
||
quindi 3505,9
|
||
|
||
|
||
|
||
|