Skip to content

Instantly share code, notes, and snippets.

@banesullivan
Created May 9, 2022 17:01
Show Gist options
  • Save banesullivan/fbce940599b920f8903b04e7eaf207e3 to your computer and use it in GitHub Desktop.
Save banesullivan/fbce940599b920f8903b04e7eaf207e3 to your computer and use it in GitHub Desktop.
orthorectify a geospatial raster
<GDAL_WMS>
<service name="TMS">
<ServerUrl>https://s3.amazonaws.com/elevation-tiles-prod/geotiff/${z}/${x}/${y}.tif</ServerUrl>
</service>
<DataWindow>
<UpperLeftX>-20037508.34</UpperLeftX>
<UpperLeftY>20037508.34</UpperLeftY>
<LowerRightX>20037508.34</LowerRightX>
<LowerRightY>-20037508.34</LowerRightY>
<TileLevel>14</TileLevel>
<YOrigin>top</YOrigin>
</DataWindow>
<Projection>EPSG:3857</Projection>
<BlockSizeX>512</BlockSizeX>
<BlockSizeY>512</BlockSizeY>
<BandsCount>1</BandsCount>
<DataType>Int16</DataType>
<ZeroBLockHttpCodes>403,404</ZeroBLockHttpCodes>
<DataValues>
<NoData>-32768</NoData>
</DataValues>
<Cache>
<Extension>.tif</Extension>
</Cache>
</GDAL_WMS>
gdalwarp \
--debug on \
-of COG -co BLOCKSIZE=64 -co COMPRESS=DEFLATE \
-multi \
--config GDAL_CACHEMAX 15% -wm 15% -co NUM_THREADS=ALL_CPUS -wo NUM_THREADS=1 \
-t_srs EPSG:4326 -et 0 -rpc -to RPC_DEM=dem.xml \
-overwrite -srcnodata 0 -dstnodata 0 \
source.tiff output.tiff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment