Skip to content
mj10777 edited this page Oct 26, 2018 · 15 revisions

Loading a RasterLite2 Image from a Geo-Referenced File

--> 'List of Sql-Commands'

<-- 'Index Page for RasterLite2 - Commands'


Original Documentation 'RasterLite2 SQL functions - reference list)'

  • RL2_GetMapImage ( coverageName String , boundingBox BLOB-Geometry , width Integer , height Integer ) : BLOB

...

  • RL2_GetMapImage ( coverageName String , boundingBox BLOB-Geometry , width Integer , height Integer , styleName String , mimeType String , bgColor String , transparent Integer , quality Integer , reaspect Integer ) : BLOB

  • Retrieve a portion of the Raster-Image
    • as TILE
-- tile_osm : 18/140813/85975, tile_tms : 18/140813/176168
SELECT 'Brandenburger Tor Zoom 18',
 RL2_GetMapImage("berlin_stadtteilgrenzen.1880",
  ST_Transform
  (
   GeomFromEWKT
   ('SRID=4326;POLYGON((13.377227783 52.516220864,
13.377227783 52.517056554,
13.378601074 52.517056554,
13.378601074 52.516220864,
13.377227783 52.516220864))'
   )
  ,3068
  )
  -- image width,height
  256,256,
  'default',
  -- image-type jpeg
  'image/jpeg',
 );
--OR simplified as
SELECT
 'Brandenburger Tor Zoom 18',
 RL2_GetMapImage
 (
  "berlin_stadtteilgrenzen.1880",
  ST_Transform
  (
   BuildMBR
   (
    13.377227783,52.516220864,13.378601074,52.517056554,4326
   ),
   3068
  ),
  -- image width,height
  256,256,
  'default',
  -- image-type jpeg
  'image/jpeg',
  -- background
  '#ffffff',
  -- transparent
  0,
  -- jpeg quality
  80,
  -- 1 = adapt image width,height if needed
  1
 );
  • 18_140813_85975.osm
    • the time needed in spatialite_gui
      • 0.030 seconds

--

  • as Geometry
    • the Geometry of the Stadtteil Alt-Cölln will be used
      • to define the area to retrieve
SELECT 'Alt-Cölln',
 RL2_GetMapImage
 (
  "berlin_stadtteilgrenzen.1880",
  (SELECT Extent(soldner_linestring) FROM ortsteile_1912 WHERE name='Alt-Cölln'),
  -- image width,height
  2000,2000,
  'default',
  -- image-type jpeg
  'image/jpeg',
  -- background
  '#ffffff',
  -- transparent
  0,
  -- jpeg quality
  80,
  -- 1 = adapt image width,height if needed
  1
 );
  • Stadtteil Alt-Cölln
    • the time needed in spatialite_gui
      • 0.470 seconds

--

  • as Random area
    • this is the geopaparazzi command to retrieve the active geometries of that area
      • at Zoom-Level 18 and further down Zoom 14
      • the query is against a SpatialView
getGeometryIteratorInBounds query[
SELECT
 -- geometry for JTS Topology Suite Library
 ST_AsBinary(CastToXY(ST_Transform(soldner_linestring,4326))),
 -- label if active
 name
FROM
 -- table/viewname
 ortsteile_1912
WHERE
ST_Intersects
(
 soldner_linestring,
 ST_Transform
 (
  BuildMBR(13.376376,52.518039,13.379595,52.515144,4326),3068)
 ) = 1 AND
 id_geometry IN
 (
  SELECT id_geometry
  FROM Spatialindex
  WHERE
   f_table_name ='ortsteile_1912' AND
   f_geometry_column = 'soldner_linestring' AND
   search_frame =
   ST_Transform
   (
    BuildMBR(13.376376,52.518039,13.379595,52.515144,4326),
    3068
   )
  );
]
  • the same area as RasterLite2 command:
SELECT 'Brandenburger Tor Zoom 18',
 RL2_GetMapImage
 (
  "berlin_stadtteilgrenzen.1880",
  ST_Transform(BuildMBR(13.376376,52.518039,13.379595,52.515144,4326),3068),
  -- image width,height
  1200,1760
  'default',
  -- image-type jpeg
  'image/jpeg',
  -- background
  '#ffffff',
  -- transparent
  0,
  -- jpeg quality
  80,
  -- 1 = adapt image width,height if needed
  1
 );
  • Brandenburger_Tor_Zoom_18

    • the time needed in spatialite_gui
      • 0.170 seconds
  • and at Zoom level 14

    • this took the longest to create in spatialite_gui
      • 1.270 seconds
  • Brandenburger_Tor_Zoom_14


2014-05-11: Mark Johnson, Berlin Germany


Clone this wiki locally