Changeset 3777

Show
Ignore:
Timestamp:
05/20/11 16:33:29 (12 months ago)
Author:
jeichar
Message:

fix of wmts bug from cedric moullet. r=jeichar closes #628

Location:
print/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • print/trunk/samples/configWMTS.yaml

    r3776 r3777  
    22# allowed DPIs 
    33#=========================================================================== 
    4 dpis: [254, 190, 127, 56] 
     4dpis: [254, 150, 127, 56] 
    55 
    66#=========================================================================== 
     
    88#=========================================================================== 
    99scales: 
     10  - 10000 
    1011  - 25000 
    1112  - 50000 
     
    2425    dummy: true 
    2526  - !dnsMatch 
    26     host: wmts9.geo.admin.ch 
     27    host: wmts0.geo.admin.ch 
    2728    port: 80 
     29  - !dnsMatch 
     30    host: tile5.geo.admin.ch 
     31    port: 80 
     32     
    2833      
    2934layouts: 
  • print/trunk/samples/specWMTS.json

    r3776 r3777  
    33    "srs": "EPSG:21781", 
    44    "layout": "A4 portrait", 
    5     "dpi": 254, 
     5    "dpi": 150, 
    66    "layers": [{ 
    7         "baseURL": "http://wmts9.geo.admin.ch/", 
    8         "layer": "ch.swisstopo.pixelkarte-farbe", 
    9         "opacity": 0.8, 
     7        "baseURL": "http://tile5.geo.admin.ch/geoadmin/", 
     8        "opacity": 1, 
     9        "singleTile": false, 
     10        "type": "TileCache", 
     11        "layer": "ch.swisstopo.swissimage", 
     12        "maxExtent": [420000, 30000, 900000, 350000], 
     13        "tileSize": [256, 256], 
     14        "extension": "jpeg", 
     15        "resolutions": [4000, 3750, 3500, 3250, 3000, 2750, 2500, 2250, 2000, 1750, 1500, 1250, 1000, 750, 650, 500, 250, 100, 50, 20, 10, 5, 2.5, 2, 1.5, 1, 0.5] 
     16    }, { 
     17        "baseURL": "http://wmts0.geo.admin.ch/", 
     18        "opacity": 1, 
     19        "singleTile": false, 
    1020        "type": "WMTS", 
     21        "layer": "ch.bafu.wasser-entnahme", 
    1122        "version": "1.0.0", 
    1223        "requestEncoding": "REST", 
    1324        "tileOrigin": [420000, 350000], 
    14         "tileSize": [256,256], 
     25        "tileSize": [256, 256], 
    1526        "style": "default", 
    16         "formatSuffix": "jpeg", 
     27        "formatSuffix": "png", 
    1728        "dimensions": ["TIME"], 
    1829        "params": { 
    19             "TIME": "2009" 
     30            "TIME": "20040101" 
    2031        }, 
    2132        "maxExtent": [420000, 30000, 900000, 350000], 
     
    2536    }], 
    2637    "pages": [{ 
    27         "center": [561280, 185250], 
    28         "scale": 25000, 
     38        "center": [578846, 183326.24545288], 
     39        "scale": 100000, 
    2940        "rotation": 0, 
    30         "dataOwner": "(c) Data: swisstopo", 
    31         "langen": true 
     41        "dataOwner": "(c) Data: swisstopo, OFEV", 
     42        "langfr": true 
    3243    }] 
    3344} 
  • print/trunk/src/main/java/org/mapfish/print/map/readers/TileableMapReader.java

    r3639 r3777  
    8181                tileMinGeoX = (float) (Math.floor((minGeoX) / tileGeoWidth) * tileGeoWidth); 
    8282                tileMinGeoY = (float) (Math.floor((minGeoY) / tileGeoHeight) * tileGeoHeight); 
     83            } else if (this instanceof WMTSMapReader) { 
     84                if (LOGGER.isDebugEnabled()) { 
     85                    LOGGER.debug("WMTS min geo x and y calculation used"); 
     86                } 
     87                tileMinGeoX = (float) (Math.floor((minGeoX - tileCacheLayerInfo.getMinX()) / tileGeoWidth) * tileGeoWidth) + tileCacheLayerInfo.getMinX(); 
     88                tileMinGeoY = (float) (tileCacheLayerInfo.getMaxY() - ((Math.ceil((tileCacheLayerInfo.getMaxY() - minGeoY) / tileGeoHeight)) * tileGeoHeight)); 
    8389            } else { 
    8490                if (LOGGER.isDebugEnabled()) { 
  • print/trunk/src/main/java/org/mapfish/print/map/readers/WMTSMapReader.java

    r3776 r3777  
    9191        WMTSLayerInfo.ResolutionInfo resolution = tileCacheLayerInfo.getNearestResolution(targetResolution); 
    9292 
    93         int col = (int) Math.round(Math.floor((minGeoX-tileOrigin.getFloat(0)) / (resolution.value * w))); 
    94         int row = (int) Math.round(Math.floor((tileOrigin.getFloat(1)-minGeoY) / (resolution.value * h))); 
     93        int col = (int) Math.round(Math.floor(((maxGeoX + minGeoX)/2-tileOrigin.getFloat(0)) / (resolution.value * w))); 
     94        int row = (int) Math.round(Math.floor((tileOrigin.getFloat(1)-(maxGeoY + minGeoY)/2) / (resolution.value * h))); 
    9595         
    9696        StringBuilder path = new StringBuilder(); 
     
    9999        } 
    100100        if (requestEncoding.compareTo("REST") == 0) { 
    101                 path.append("wmts"); 
    102                 path.append('/').append(version); 
     101                path.append(version); 
    103102                path.append('/').append(layer); 
    104103                path.append('/').append(style);