D 2022-06-04T09:44:41.918
L OSM\sBerlin\sSurprises
U sandro
W 11728
Back to OSM Berlin Index
Where we are
Since now in this tutorial we've simply examined the external skin of the Rendering Engine implemented by librasterlite2 and directly integrated in spatialite_gui via its Map Panel.
It's now time to come down to greater depth so to appreciate all the revolutionary power it can offer.
Be prepared for unexpected surprises.
|
First surprise: Styled Maps can be created by pure SQL statements
The Rendering Engine (and all that it implies in terms of Styled Map Layers) is fully implemented by librasterlite2, that actually is a dymanic extension expanding the basic SQL capabilities of SQLite.
This practically means that complex richly styled Maps can be created in the easiest way by just executing some appropriate SQL statement.
Such a capability immediately opens the doors for an easy and simple integration of the Rendering Engine in whatever programming language: C/C++, Java, Python, PHP and many others.
The basic approach will always be exactly the same for all them:
- Establish a connection to the SQLite database containing the Map by using the language bindings for your specific language.
- Then load both extensions SpatiaLite and RasterLite2
- Now you'll be ready for executing any RasterLite2 SQL function returning a Styled Map
- Each function will then return a BLOB object containing the image corresponding to your request.
- At this point your program will simply take some appropriate action (as e.g. displaying the image on the screen) and that's all.
Said in other words: developing a feature rich Map Viewer tool will just require to implement the interactive zoom and pan logic.
Any other related task will then directly delegated to the SQL level. Your program will be just required to manage some appropriate SQL query
Note that this is an almost universally portable architecture available on practically any of the most common programming languages requiring only few very basic prerequisites:
- Support for some kind of SQLite connector being enabled to dynamically load extension modules.
- Installing both SpatiaLite and RasterLite2 extensions.
A practical example based on the OSM Berlin Map
SELECT RL2_GetImageFromMapConfiguration('osm-berlin',
BuildMbr(391981.48944364, 5820790.78669314, 392990.18818636, 5821799.48543586, 25833),
1024, 1024,
'image/png');
- the first argument corresponds to the Map Configuration name (expected to exists into the connected database).
- the second argument corresponds to the Bounding Box to be covered by the image to be created.
- the third and fourth arguments respectively are the width and heigth (in pixels) pf the image.
- and finally the fifth argumets is the MIME type identified the format of the BLOB image to be returned.
The following MIME types are supported:
- image/png TRUE color (RGB) PNG
- image/png8 grayscale or palette based PNG (8 bits X pixel)
- image/gif GIF
- image/jpeg JPEG compressed image
- image/tiff TRUE color (RGB) TIFF
- image/tiff8 grayscale or palette based TIFF (8 bits X pixel)
- image/geotiff TRUE color (RGB) GeoTIFF
- image/geotiff8 grayscale or palette based GeoTIFF (8 bits X pixel)
- application/pdf or application/x-pdf PDF document
- image/vnd.rl2rgba a flat RGBA matrix of HEIGHT scanlines (from top to bottom)
Each scanline contains WIDTH pixels (from left to right)
Pixels are strictly packed, each one of them requiring 4 bytes. (Red, Green, Blue and Alpha channels).
Note: this specific format usually corresponds to the native one supported by many screen devices.
This is the PNG image returned by the previous SQL Query.
Second surprise: Styled Maps are always ready to be immediately published as WMS - Web Map Services
More precisely, it just requires to create an XLM file defining the WMS service you intend to publish on the WEB.
Dpn't worry, it's a very simple step fully supported by a specific GUI Wizard
|
piro piro
|
|
|
piro piro
|
|
|
piro piro
|
|
|
piro piro
|
|
|
piro piro
|
|
|
piro piro
|
|
|
piro piro
|
|
azbratovar
|
piro piro
|
|
|
piro piro
|
|
|
stozzac
WMS
WmsLite test server
A simple light-weight WMS server for testing RasterLite2 Coverages.
some keyword
another keyword
http://localhost:8080/wmslite?
James T. Kirk
United Federation of Planets, Starfleet
Starship Captain
stellar
USS Enterprise
Planet Earth
Solar System
12345#WYZ47NL@512
Milky Way Galaxy
positron@antimatter.org
none
none
10
5000
5000
Top Level Layer
forests
water_bodies
agriculture
green_areas
buildings
religion
rivers
cemeteries
motorway
trunk
rd_primary
rd_secondary
rd_tertiary
rd_residential
paths
cycleways
subway
rail
light_rail
tram
suburbs
railway_stations
tram_stops
|
Back to OSM Berlin Index
Z 78c84b16dad023728dc3003f9ddc650d