rio tiler

2022-08-18  本文已影响0人  hehehehe

https://github.com/cogeotiff/rio-tiler
https://github.com/developmentseed/rio-viz

https://github.com/DHI-GRAS/terracotta

rio viz /Users/shilulu/Downloads/sand_test.tif --reader rio_tiler.io.COGReader

https://github.com/developmentseed/titiler

http://127.0.0.1:8000/cog/viewer?url=/Users/xxx/Downloads/tmp/20200613clip/B1.tif

gdal2tiles.py

docker cp Downloads/tmp/20200613clip/B2.tif 9ee887fda233:/tmp
gdal_translate -of VRT -ot Byte -scale B1.tif temp.vrt
gdal2tiles.py --zoom 8-14 temp.vrt ./tile/

送大佬上地图

from osgeo import gdal
ds1 = gdal.Open("tmp/20200613clip/B1.tif")
ds2 = gdal.Open("20220819-144742.jpeg")

im_geotrans = ds1.GetGeoTransform()
im_proj = ds1.GetProjection()

driver = gdal.GetDriverByName("GTiff")
output = driver.Create("tmp/20200613clip/aa.tif", ds2.RasterXSize, ds2.RasterYSize, 3, gdal.GDT_Byte)

output.SetGeoTransform(im_geotrans) 
output.SetProjection(im_proj) 

im_data1 = ds2.GetRasterBand(1).ReadAsArray(xoff=0, yoff=0, win_xsize=ds2.RasterXSize, win_ysize=ds2.RasterYSize)
im_data2 = ds2.GetRasterBand(2).ReadAsArray(xoff=0, yoff=0, win_xsize=ds2.RasterXSize, win_ysize=ds2.RasterYSize)
im_data3 = ds2.GetRasterBand(3).ReadAsArray(xoff=0, yoff=0, win_xsize=ds2.RasterXSize, win_ysize=ds2.RasterYSize)


output.GetRasterBand(1).WriteArray(im_data1)
output.GetRasterBand(2).WriteArray(im_data2)
output.GetRasterBand(3).WriteArray(im_data3)
output.FlushCache()
del output

上一篇 下一篇

猜你喜欢

热点阅读