[OpenLayers-Users] TMS Layer origin and bounding box

Gérald Quintana gerald.quintana at gmail.com
Tue Apr 8 09:50:00 EDT 2008


The gdal2tiles.py tools generates a sample openlayers.html which works
perfectly with the script http://www.openlayers.org/api/OpenLayers.js.
As soon as I replace it by the 2.6rc1 release, I get an error
"this.projection.getUnits is not a function" in the setMap function of
the Layer class.

I think it comes from the way maxExtent and projection options are
initialized in the example:
       var options = {
            controls: [],
            maxExtent: new OpenLayers.Bounds(0, 0, 2770, 2270),
            maxResolution: 16,
            numZoomLevels: 5,
            units: 'pixels',
            projection: ""
        };
        map = new OpenLayers.Map("map", options);
        map.addControl(new OpenLayers.Control.PanZoomBar());
        map.addControl(new OpenLayers.Control.MouseDefaults());
        map.addControl(new OpenLayers.Control.KeyboardDefaults());
        // OpenLayers 2.5 TMS driver
        layer = new OpenLayers.Layer.TMS( "TMS",
                "", {layername: '.', serviceVersion: '.', type:'png'} );
        map.addLayer(layer);
        map.zoomTo(3);

Did someone used this gdal2tiles.py tool?
How can I mix this TMS+strange SRS with a classical WMS layer+EPSG:4326?

Thanks for your help,
Gérald


2008/4/7, Gérald Quintana <gerald.quintana at gmail.com>:
> Hi all,
>
>  I have generated TMS pictures with the gdal2tiles.py tool from a
>  PNG+WLD. I got a tilemapresource.xml and PNG named x/y/z.png with
>  x<5,y<10 and z<10. I placed them on my webserver and added a TMS layer
>  to my OL map.
>
>  But I can see with FireBug that OL is looking for pictures like
>  0/1258/973.png that I don't have. I guess that OL doesn't read the
>  tilemapresource.xml and I have to tell him the origin and bounding box
>  of the tiles. I tried to set the maxExtent and tilesOrigin attributes
>  of the TMS layer, but it doesn't help.
>
>  Could you tell me what I should do? I presume it's obvious.
>  Thanks,
>  Gerald
>



More information about the Users mailing list