While working on sql-scripts to use 'RL2_LoadRastersFromDir', I have run into unexpected problems
- the expected problems have been resolved
-- mainly importing images of different resolutions
---> use of mixed_resolutions= when creating the RasterCoverage
In the alpha version of RasterLite2, I had noticed that there were gaps in the tiles when using single images from a directory
- and I wanted to check if this has been resolved
The data used here can be downloaded at:
Dritte_Landesaufnahme.Toscana/
- directory with 9 GeoTiff (Area around Toscana), pus a gdal created Virtual files used to create a single image
--> 1904.30_44_Ravenna.200000.4805.tif
the original image was faulty (scan error) a small portion at the bottom is missing
--> Each image is 1x1 degree using srid=4805 [MGI (Ferro), Militar_Geographische_Institut_Ferro]
sql/
- the sql scripts used for
-- RL2_LoadRastersFromDir
-- RL2_LoadRaster
- the created db's from the sql_scripts
-- dritte_landesaufnahme_toscana.db
-- dritte_landesaufnahme_toscana_dir.db
gdal_commands.txt
- gdal commands used to create an single image from the 9 GeoTiffs
All GeoTifs show up correctly in QGIS
---
'RL2_LoadRastersFromDir'
- I am very sure that this as been done correctly
-- the following command show the expected results
rl2tool LIST --db-path dritte_landesaufnahme_toscana.db --coverage "dritte_landesaufnahme_toscana"
rl2tool LIST --db-path dritte_landesaufnahme_toscana_dir.db --coverage "dritte_landesaufnahme_toscana_dir"
- shows for the image number 6:
-------------------------------------------------------------------------------
Section: (6) 1905.29_44_Florenz.200000.4805
-------------------------------------------------------------------------------
Size (pixels): 4192 x 4192
Input Path: *** unknowon ***
LowerLeft corner: X=28.50 Y=43.50
UpperRight corner: X=29.50 Y=44.50
Center Point: X=29.00 Y=44.00
-------------------------------------------------------------------------------
- the (Ferro) positions are correct
---
Both databases show incorrectly in LibreWMS
- "dritte_landesaufnahme_toscana_dir"
-- only 3 images can be seen, they are not correctly positioned
-- when zooming into the Top/Left image (1903.27_44_Genua)
--> Scale 1:344330 (Area Genova --> Speczia)
--- the positioning on the coast line is irregular
---- the irregularity changes with every zoom level
- "dritte_landesaufnahme_toscana"
-- the whole image is shown
--- otherwise save effect
Same effect when WMS is called from QGIS.
Conclusion 01: the faulty rendering has nothing to do with 'RL2_LoadRastersFromDir'
---
I then attempted to export a portion of the coverage:
rl2tool EXPORT --db-path dritte_landesaufnahme_toscana.db --dst-path 1903.Genua.Spezia.tif --compression JPEG --coverage "dritte_landesaufnahme_toscana" --center-x 27.5 --center-y 44.0 --resolution 0.000235960358660 --out-width 1000 --out-height 1000
--> failed without reason
SELECT RL2_GetMapImageFromRaster('dritte_landesaufnahme_toscana',BuildMBR(27.0,43.5,28.0,44.5),1000,1000,'default','image/tiff','#000000',0,80, 1) AS 'dritte_landesaufnahme_toscana.tif';
- image created in spatialite_gui
--> exported to tiff
---> dritte_landesaufnahme_toscana.tif
-----> shows expected area
---> dritte_landesaufnahme_toscana_dir.tif
-----> shows portion on the Genua map, Livorno portion is black
Conclusion 02: RL2_GetMapImageFromRaster does not retrieve image portions created with 'RL2_LoadRastersFromDir'
gdalinfo dritte_landesaufnahme_toscana.tif
- shows
Coordinate System is:
LOCAL_CS["MGI (Ferro)",
UNIT["unknown",1]]
gdalinfo of 1903.27_44_Genua.200000.4805.tif
- original tiff file
Coordinate System is:
GEOGCS["MGI (Ferro)",
DATUM["Militar_Geographische_Institut_Ferro",
SPHEROID["Bessel 1841",6377397.155,299.1528128000033,
AUTHORITY["EPSG","7004"]],
TOWGS84[682,-203,480,0,0,0,0],
AUTHORITY["EPSG","6805"]],
PRIMEM["Ferro",-17.66666666666667],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4805"]]
SELECT srtext FROM spatial_ref_sys where srid=4805
GEOGCS["MGI (Ferro)",DATUM["Militar_Geographische_Institut_Ferro",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],TOWGS84[682,-203,480,0,0,0,0],AUTHORITY["EPSG","6805"]],PRIMEM["Ferro",-17.66666666666667,AUTHORITY["EPSG","8909"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4805"]]
To make sure that spatialite_gui, when exporting to a tiff file from a RasterLite2 query
- I did the same for a Solder Berlin image
rl2tool EXPORT --db-path 1910.berlin_data.db --dst-path 1811.Rote_Rathaus.jpeg.tif --compression JPEG --coverage 1811.berlin_selter --center-x 25258.22999992637051 --center-y 21288.28000037543825 --resolution 0.475212 --out-width 7953 --out-height 5965
SELECT RL2_GetMapImageFromRaster('1811.berlin_selter',BuildMBR(23368.549,19870.962,27147.909,22705.600),7953,5965,'default','image/tiff','#FFFFFF',0,80, 1) AS '1811.Rote_Rathaus';
and the results of gdalinfo look the same to me.
Conclusion 03: somehow the srid is not being correctly used when reading the created database.
--
Final conclusion:
- there are 2 errors here
- I will try this with some images of 'Soldner Berlin', to see if there is a difference
(we just has a 5 min. power out, just after writing 'Conclusion 03' - for us it is a 'hot' day)
Mark