Skip to content

RL2_LoadRasterFromWMS

Mark Johnson edited this page Oct 6, 2018 · 9 revisions

Filling a Raster Coverage from a WMS service

--> 'List of Sql-Commands'

<-- 'Index Page for RasterLite2 - Commands'


Original Documentation RasterLite2 SQL functions - reference list)

  • RL2_LoadRasterFromWMS(text coverage, text section, text getmap_url, BLOB geom, text wms_version, text wms_layer, text wms_style, text wms_format, double horz_res , double vert_res, int opaque, int swap_xy, text proxy, int transaction)

Parameters [optional parameters]:

  • coverage: chosen name of raster_coverage
  • section: section name
    • A NULL section always implies processing the whole Coverage
  • getmap_url:
  • geom: to define the area to retrieve
  • wms_version: 1.1.1 or 1.3.0
  • wms_layer: one or more layers that the wms-service may offer
  • wms_style: this is a style offered by the wms-service
  • horz_res: the resolution to store the image in the database
    • when vert_res is NOT used
  • [vert_res]:
  • [opaque]:
  • [swap_xy]:
    • 1.1.1 : this should probably remain '0' (using x/y)
    • 1.3.0 :
      • with '0' using y/x
      • with '1' will act as if it is a 1.1.1 wms-service (using x/y)
  • [proxy]:
  • [transaction]:

  • Sample to retrieve a specific area around a specific point

    • 1000 Meters around the Brandenburg Gate
  • Many of these settings are based on the results of

wget 'http://fbinter.stadt-berlin.de/fb/wms/senstadt/http://fbinter.stadt-berlin.de/fb/wms/senstadt/k_luftbild1928?SERVICE=WMS&REQUEST=GetCapabilities' -O Berlin_Luftbilder_1928.txt

The following need to be extracted from the GetCapabilities results:

  • wms-version
  • wms-layer(s) to retrieve
  • wms-stlyes(s) to use when retrieving
  • image-type to retrieve
  • resolution
    • if the original resolution is known, this should be used
      • but this information is rarely offered
SELECT RL2_LoadRasterFromWMS
( -- Time needed to complete: 4 minutes (at 5h in the morning)
 -- coverageName = Table-Name
 '1928.berlin_luftbilder_1500_bb_tor', 
 -- sectionName
 --- A NULL sectionName always implies processing the whole Coverage
 '1928.Berlin_Luftbilder.0250.3068',
 -- getMapUrl 
 'http://fbinter.stadt-berlin.de/fb/wms/senstadt/k_luftbild1928',
 --- 1000 Meters around the Brandenburg Gate
 -- ST_Envelope(MakeCircle(23180.811529435785,21046.90882931085,(1000/2),3068)),
 BuildMbr
 ( -- Area 1000 meters wide, 1500 high
  -- 500 meters West of the Brandenburg Gate
  (ST_MinX(ST_Envelope(MakeCircle(23180.811529435785,21046.90882931085,(1000/2),3068)))),
  -- 1000 meters South of the Brandenburg Gate, including Potsdamer Platz/Bahnohf
  (ST_MinY(ST_Envelope(MakeCircle(23180.811529435785,21046.90882931085,(1000/1),3068)))),
  -- 500 meters East of the Brandenburg Gate
  (ST_MaxX(ST_Envelope(MakeCircle(23180.811529435785,21046.90882931085,(1000/2),3068)))),
  -- 500 meters North of the Brandenburg Gate
  (ST_MaxY(ST_Envelope(MakeCircle(23180.811529435785,21046.90882931085,(1000/2),3068)))),
  3068
 ),
 -- wmsVersion 1.3.0 '1.1.1',
 '1.1.1',
 -- wmsLayerName CASTORE_WMS
 '0',
 -- wmsLayerStyle <Name>default</Name>
 'default',
 -- wmsImageFormat 
 'image/jpeg',
 -- wmsHorzPixelResolution
 0.280053796298,
 -- wmsVertPixelResolution
 0.280053796298,
 0,
 0,
 '',
 0
);

The result in QGIS would then looks like this:

  • background: 1750 map of Berlin
  • geometries: 1928 districts of Berlin
  • from wms source : 1928 Aerial area around the Brandenburg Gate
    • 500 meters West of the Brandenburg Gate
    • 500 meters North of the Brandenburg Gate
    • 500 meters East of the Brandenburg Gate
    • 1000 meters South of the Brandenburg Gate
      • including Potsdamer Platz / Bahnhof

Preview : Area around the Brandenburg Gate


2015-09-01: Mark Johnson, Berlin Germany


Clone this wiki locally