Skip to content

Return Code Problems

Mark Johnson edited this page Nov 12, 2015 · 6 revisions

Return code Problems caused by lack of proper Return code support in internal functions

[--> 'List of Sql-Commands'] (Home#commands)

[<-- 'Index Page for RasterLite2 - Commands'] (RasterLite2-Index#commands)

[<-- 'Cutline / RasterDefaults Index'] (Cutline-Index)


The intention is for a zoom base applications to retrieve information about usable zoom_levels

RasterLite2 is indended to be a Wms-based System

  • where the use of Scales and Resolutions are used to maneuver around the supported area

Often such Resolutions are based on the Coordinate System being used

  • as such, a common comparison is often not possible

Here Scales are more useful

  • and that is what most Wms-clients use

Zoom-Levels also use Scales a base for determining the Zoom-Levels

  • often, but not always, 1:4000 being set as Zoom 17

Taking into consideration

  • that there are many Zoom-Levels Applications exist and
  • that many people essentially know what Zoom 17 implies

The major goal was to offer

  • both Wms and Zoom-Level Applications
    • a range of Resolutions/Scale/Zooms-Levels
      • showing usable results

For Wms-Clients

  • Wms 1.1.1 : ScaleHint
  • Wms 1.3.0 : Min/Max-ScaleDenominator

For Zoom-Level-clients

  • zoom_min
  • zoom_max

Many User-Friendly Applications also offer a default

  • (Center) Position
  • zoom_default

With this in mind, each raster_coverage, using RasterDefaults will store a

  • default Center-Position
  • and estimated min/default/max Zoom-Level

For this an Sql-command has been developed to retrieve this information

  • ['RL2_GetRasterCoverageDefaults(coverage_name)'] (RL2_GetRasterCoverageDefaults)
    • which will return 2 csv fields [separated with a ;]
      • center_x,center_y,center_srid [separated with a ,]
      • zoom_min,zoom_default,zoom_max [separated with a ,]
SELECT 
 coverage_name,
 RL2_GetRasterCoverageDefaults(coverage_name) 
FROM raster_coverages;

1861.world_mercators	           -1982.3723119,-1224.5405843,3395;3,5,7
1868.rote_rathausturm_panorama	   4987.5000000,502.0000000,-1;15,17,19
1927.436b_43668	                   6400.0000000,28000.0000000,3068;16,18,20
dritte_landesaufnahme_toscana	   28.5000000,43.0000000,4805;10,13,16
dritte_landesaufnahme_toscana_dir  28.5000000,43.0000000,4805;6,13,20

The original values are first calculated during

  • 'RL2_LoadRaster'
    • Center-Point being the Center of the raster_coverage
    • zoom_default being based on the original raster resolution set in:
      • x_resolution_1_1
        • should result in original resolution of the image (100%)
    • zoom_min being based on the original raster resolution set in:
      • x_resolution_1_8 + 2 zoom_levels
        • should result in a usable overview of the whole raster coverage
    • zoom_max being based on the difference of zoom_default and zoom_min
      • zoom_max=zoom_default+(zoom_default-zoom_min)
        • an enlargement original resolution of the image (ca. 400%)

and updated during any following

Afterwhich, a Database Designer, can adapt the values as needed with

SELECT RL2_SetRasterCoverageDefaults
(
 'dritte_landesaufnahme_toscana', -- raster_coverage name
 MakePoint(681582.6377649425,4849582.896019161,23032), -- center_point
 10, -- zoom_min
 14, -- zoom_default
 18  -- zoom_max
);

Validity rules:

  • Center-Point
    • will be transformed to the srid of the raster_coverage when needed
    • must be inside the raster_coverage (after possible transformation)
      • if not the function will fail
  • Zoom-Levels
    • must be between 0 and 30
      • values outside this range will be ignored
        • when you only want to set the zoom_default to 18
          • SELECT RL2_SetRasterCoverageDefaults('coverage_name',-1,18,-1)
    • zoom_min < zoom_default < zoom_max * if not the function will fail

Resetting back to default values

  • possible values of 2nd parameter
    • 0 = all values (Center-Point and Zoom-Levels)
    • 1 = Center-Point only
    • 2 = Zoom-Levels only
SELECT RL2_SetRasterCoverageDefaults
(
 'dritte_landesaufnahme_toscana', -- raster_coverage name
 0 -- 0,1 or 2
);

2015-11-10: Mark Johnson, Berlin Germany