Current x value is too far from tile corner x

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Current x value is too far from tile corner x

Jackey Cheung
Hi all,

I'm having this error lately, driving me mad.

The map works fine mostly, unless I zoom in to the last few level.
After zoomed in, the error starts popping up. The error persists with
or without using sperical mercator. Below are the settings of
TileCache and OpenLayers.


TileCache:
[4326en]
type=WMSLayer
url=http://localhost/wms.php?lang=en
layers=national_border
extension=png
metaSize=10,10
sendfile=yes
metaTile=true
#extent_type=loose
bbox=-180,-90,180,90
#spherical_mercator=true
resolutions=1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.00002145767211914062,0.00001072883605957031,0.00000536441802978515,0.00000268220901489257,0.0000013411045074462891,0.00000067055225372314453


OpenLayers:
       var options4326 =
       {
               resolutions:
[0.17578125,0.0439453125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.00001072883605957031,0.00000536441802978515,0.00000268220901489257],
               maxExtent: new OpenLayers.Bounds(-180,-90,180,90),
               projection:"EPSG:4326",
               controls: []
       };
       g_map = new OpenLayers.Map('map', options4326);
       var bg = new OpenLayers.Layer.WMS("Base", tclinks,
                   {layers:'4326en',format:'image/png'
                    /*,sphericalMercator:true*/},
                   {transitionEffect: 'resize'});
       g_map.addLayer(bg);
_______________________________________________
Tilecache mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/tilecache
Reply | Threaded
Open this post in threaded view
|

Re: Current x value is too far from tile corner x

Brian Case
Jackey,


edit TileCache/Layer.py
in the method getCell()
change

        x = int(x0)
        y = int(y0)

to

        x = round(x0)
        y = round(y0)

Brian


On Thu, 2012-01-19 at 17:08 +0800, Jackey Cheung wrote:

> Hi all,
>
> I'm having this error lately, driving me mad.
>
> The map works fine mostly, unless I zoom in to the last few level.
> After zoomed in, the error starts popping up. The error persists with
> or without using sperical mercator. Below are the settings of
> TileCache and OpenLayers.
>
>
> TileCache:
> [4326en]
> type=WMSLayer
> url=http://localhost/wms.php?lang=en
> layers=national_border
> extension=png
> metaSize=10,10
> sendfile=yes
> metaTile=true
> #extent_type=loose
> bbox=-180,-90,180,90
> #spherical_mercator=true
> resolutions=1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.00002145767211914062,0.00001072883605957031,0.00000536441802978515,0.00000268220901489257,0.0000013411045074462891,0.00000067055225372314453
>
>
> OpenLayers:
>        var options4326 =
>        {
>                resolutions:
> [0.17578125,0.0439453125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.00001072883605957031,0.00000536441802978515,0.00000268220901489257],
>                maxExtent: new OpenLayers.Bounds(-180,-90,180,90),
>                projection:"EPSG:4326",
>                controls: []
>        };
>        g_map = new OpenLayers.Map('map', options4326);
>        var bg = new OpenLayers.Layer.WMS("Base", tclinks,
>                    {layers:'4326en',format:'image/png'
>                     /*,sphericalMercator:true*/},
>                    {transitionEffect: 'resize'});
>        g_map.addLayer(bg);
> _______________________________________________
> Tilecache mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/tilecache


_______________________________________________
Tilecache mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/tilecache
Reply | Threaded
Open this post in threaded view
|

Re: Current x value is too far from tile corner x

markieta
Registered to say that this helped me out, so a big thanks here!

Can you explain how/why this works?

Cheers,

Michael