Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

We are using GEOSERVER 2.1.4 to overlay WMS on GoogleMaps V3 with Openlayers .

The problem we have is at different zoom levels the scale of the WMS overlay is different from the scale of the base layer.

It is only at scale 1:1000 and 1:2000 that overlay and base layer coincide.

Any suggestions?

The part of the code:

        var map;
        var untiled;
        var tiled;
        var pureCoverage = false;
    OpenLayers.Lang.setCode('el');  
        // pink tile avoidance
        OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;
        // make OL compute scale according to WMS spec
        OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;

        function map_reg_init(){
            // if this is just a coverage or a group of them, disable a few items,
            // and default to jpeg format
            format = 'image/png';
            if(pureCoverage) {
                document.getElementById('filterType').disabled = true;
                document.getElementById('filter').disabled = true;
                document.getElementById('antialiasSelector').disabled = true;
                document.getElementById('updateFilterButton').disabled = true;
                document.getElementById('resetFilterButton').disabled = true;
                document.getElementById('jpeg').selected = true;
                format = "image/jpeg";
            }
    var projEGSA=new OpenLayers.Projection("EPSG:2100");
    var projLONLAT = new OpenLayers.Projection("EPSG:4326");
        var projGOOGLE=new OpenLayers.Projection("EPSG:900913");
            var bounds = new OpenLayers.Bounds(
                2327363.1529655424, 4805801.76429202,
                2328463.0753220413, 4806793.842097636
            );
    var scales = [500, 1000, 2000, 4000, 5000, 10000, 15000, 25000, 50000];
    var resolutions = [];
    for(var i = 0; i < scales.length; i++) {
        resolutions.push(OpenLayers.Util.getResolutionFromScale(scales[i], 'm'));
    }

            var options = {
                controls: [],
                maxExtent: bounds,
        scales: scales,     
                maxResolution: 156543.0339,
            numZoomLevels    : 22,
                allOverlays      : true,    
                projection: "EPSG:900913",
                units: 'm'
            };
    var mousePointerStyle = 'default';
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

"google maps" has pre-defined scales with 20 pre-defined zoom Levels.

I am no expert, but maybe this is a hint:

20 : 1128.497220
19 : 2256.994440
18 : 4513.988880
17 : 9027.977761
16 : 18055.955520
15 : 36111.911040
14 : 72223.822090
13 : 144447.644200
12 : 288895.288400
11 : 577790.576700
10 : 1155581.153000
9  : 2311162.307000
8  : 4622324.614000
7  : 9244649.227000
6  : 18489298.450000
5  : 36978596.910000
4  : 73957193.820000
3  : 147914387.600000
2  : 295828775.300000
1  : 591657550.500000

cheers

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.