lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Quintiq file version 2.0
#parent: #root
Method DoGetCapabilities
{
  #keys: '1[103544.0.740661339]'
  TextBody:
  [*
    // Administrator Mar-12-2012 (created)
    utils := this.LibOSM_Utils();
    result := this.Result();
    mapcapabilitieshandle := result.GetHandle( "mapcapabilities" );
    tiledhandle := result.GetHandle( "tiled" );
    widthhandle := result.GetHandle( "width" );
    heighthandle := result.GetHandle( "height" );
    srswkthandle := result.GetHandle( "srswkt" );
    boundingboxhandle := result.GetHandle( "boundingbox" );
    lefttophandle := result.GetHandle( "lefttop" );
    xhandle := result.GetHandle( "x" );
    yhandle := result.GetHandle( "y" );
    rightbottomhandle := result.GetHandle( "rightbottom" );
    originhandle := result.GetHandle( "origin" );
    formathandle := result.GetHandle( "format" );
    resolutionshandle := result.GetHandle( "resolutions" );
    resolutionhandle := result.GetHandle( "resolution" );
    cachecapabilitieshandle := result.GetHandle( "cachecapabilities" );
    maxnrtileshandle := result.GetHandle( "maxnrtiles" );
    resultroot := result.Root();
    
    mapcapabilities := resultroot.AddChild( mapcapabilitieshandle );
    tiled := mapcapabilities.AddChild( tiledhandle );
    tiled.AddChild( widthhandle, 256 );
    tiled.AddChild( heighthandle, 256 );
    srswkt := tiled.AddChild( srswkthandle );
    srswkt.SetValue( LibOSM_OSMGISLibrary::GetMapSRSWKT() );
    boundingbox := tiled.AddChild( boundingboxhandle );
    lefttop := boundingbox.AddChild( lefttophandle );
    lefttop.AddChild( xhandle, -20037508.34 );
    lefttop.AddChild( yhandle, 20037508.34 );
    rightbottom := boundingbox.AddChild( rightbottomhandle );
    rightbottom.AddChild( xhandle, 20037508.34 );
    rightbottom.AddChild( yhandle, -20037508.34 );
    origin := tiled.AddChild( originhandle );
    origin.AddChild( xhandle, -20037508.34 );
    origin.AddChild( yhandle, -20037508.34 );
    format := tiled.AddChild( formathandle );
    format.SetValue( LibOSM_OSMGISLibrary::GetDefaultImageFormat() );
    resolutions := tiled.AddChild( resolutionshandle );
    // resolution: map units per pixel (map units are typically degrees or meters)
    // References:
    // http://wiki.openstreetmap.org/wiki/FAQ#What_is_the_map_scale_for_a_particular_zoom_level_of_the_map.3F
    // http://almien.co.uk/OSM/Tools/Scale/
    // http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
    // http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/
    // The resolution of the zoom level 0 is ( 2 * 20037508.34 ) / 256 = 156543.03390625
    // The resolution of zoom level i is resolution_zoom_level_(i-1) / 2, i >= 1, i < = 18
    // To preserve as much precision as possible, the divisions were made using the exact value of the resolution of the previous level; however, the results were truncated to 8 digits of precision.
    resolutions.AddChild( resolutionhandle, 156543.03390625 );  // Zoom level 0 (1 tile)
    resolutions.AddChild( resolutionhandle, 78271.51695312 );   // Zoom level 1 (2x2 = 4 tiles); exact value: 78271.516953125
    resolutions.AddChild( resolutionhandle, 39135.75847656 );   // Zoom level 2 (4x4 = 16 tiles); exact value: 39135.7584765625
    resolutions.AddChild( resolutionhandle, 19567.87923828 );   // Zoom level 3; exact value: 19567.87923828125
    resolutions.AddChild( resolutionhandle, 9783.93961914 );    // Zoom level 4; exact value: 9783.939619140625
    resolutions.AddChild( resolutionhandle, 4891.96980957 );    // Zoom level 5; exact value: 4891.9698095703125
    resolutions.AddChild( resolutionhandle, 2445.98490478 );    // Zoom level 6; exact value: 2445.98490478515625
    resolutions.AddChild( resolutionhandle, 1222.99245239 );    // Zoom level 7; exact value: 1222.992452392578125
    resolutions.AddChild( resolutionhandle, 611.49622619 );     // Zoom level 8; exact value: 611.4962261962890625
    resolutions.AddChild( resolutionhandle, 305.74811309 );     // Zoom level 9; exact value: 305.74811309814453125
    resolutions.AddChild( resolutionhandle, 152.87405654 );     // Zoom level 10; exact value: 152.874056549072265625
    resolutions.AddChild( resolutionhandle, 76.43702827 );      // Zoom level 11; exact value: 76.4370282745361328125
    resolutions.AddChild( resolutionhandle, 38.21851413 );      // Zoom level 12; exact value: 38.21851413726806640625
    resolutions.AddChild( resolutionhandle, 19.10925706 );      // Zoom level 13; exact value: 19.109257068634033203125
    resolutions.AddChild( resolutionhandle, 9.55462853 );       // Zoom level 14; exact value: 9.5546285343170166015625
    resolutions.AddChild( resolutionhandle, 4.77731426 );       // Zoom level 15; exact value: 4.77731426715850830078125
    resolutions.AddChild( resolutionhandle, 2.38865713 );       // Zoom level 16; exact value: 2.388657133579254150390625
    resolutions.AddChild( resolutionhandle, 1.19432856 );       // Zoom level 17; exact value: 1.1943285667896270751953125
    resolutions.AddChild( resolutionhandle, 0.59716428 );       // Zoom level 18; exact value: 0.59716428339481353759765625
    
    cachecapabilities := tiled.AddChild( cachecapabilitieshandle );
    cachecapabilities.AddChild( maxnrtileshandle, utils.GetOrCorrectMaxNrTilesSetting() );
    
    utils.DebugDump( "getcapabilities_result.txt", resultroot );
    
    this.Done();
  *]
}