Skip to content
Mark Johnson edited this page Oct 6, 2018 · 14 revisions

Exporting an GeoTiff-Image from a Raster Coverage

--> 'List of Sql-Commands'

<-- 'Index Page for RasterLite2 - Commands'


Original Documentation RasterLite2 SQL functions - reference list)

  • RL2_WriteGeoTiff(text coverage, text geotiff_path, int width, int height, BLOB geom, double horz_res , double vert_res, int with_worldfile, text compression, int tile_sz)

Parameters [optional parameters]:

  • coverage: chosen name of raster_coverage
  • geotiff_path: file-name with path to export the Image to
  • width:
  • height:
  • geom:
  • horz_res: the resolution to store the image with
    • when vert_res is NOT used
  • [vert_res]:
  • [with_worldfile]: create a world file [0=no, 1=yes]
  • [compression]:
  • [tile_sz]: 256 [default], 64 [minimum]

  • Sample for a GeoTiff
    • where the x/horizontal and y/vertical resolution are the same
SELECT RL2_WriteGeoTiff
(
 -- raster_coverage
 '1928.berlin_luftbilder_1000_bb_tor', 
 -- file-name with path
 '../berlin_images/1928.berlin_luftbilder_1000_bb_tor.3068.tif', 
 -- image-width based on extent of polygon and base-resolution
 (
  CastToInteger
  (
   (
    ST_MaxX(ST_Envelope(MakeCircle(23180.811529435785,21046.90882931085,(1000/2),3068)))-
    ST_MinX(ST_Envelope(MakeCircle(23180.811529435785,21046.90882931085,(1000/2),3068)))
   )/0.280053796298
  )
 ),
 -- image-height based on extent of polygon and base-resolution
 (
  CastToInteger
  (
   (
    ST_MaxY(ST_Envelope(MakeCircle(23180.811529435785,21046.90882931085,(1000/2),3068)))-
    ST_MinY(ST_Envelope(MakeCircle(23180.811529435785,21046.90882931085,(1000/2),3068)))
   )/0.280053796298
  )
 ), 
 --- 1000 Meters around the Brandenburg Gate
 ST_Envelope(MakeCircle(23180.811529435785,21046.90882931085,(1000/2),3068)),
 -- use base-resolution
 0.280053796298,0.280053796298, 
 -- no world-file
 0, 
 -- compression
 'JPEG',
 -- tile_size [Block=128x128]
 128
);

The result in QGIS then looks like this:

  • background: 1750 map of Berlin
  • geometries: 1928 districts of Berlin
  • from wms source : 1928 1500 Meters around the Brandenburg Gate arial

Preview : 1500 Meters around the Brandenburg Gate


2015-09-01: Mark Johnson, Berlin Germany