[gdal-dev] How to merge Tiled images and WMS layer with openlayers?

Myeong Hun Jeong mhjeong74 at gmail.com
Wed Sep 10 05:11:02 EDT 2008

Dear list.First, I made tiled images(png) with gdal2tiles.py.
For example, python gdal2tiles.py -title "tile" -publishurl -nogooglemaps -nokml -v
D:\test\raster\image.tif D:\test\raster\tile --config GDAL_CACHEMAX 120
and I  moved the image files into Tomcat and tested
It runs well.
Next, I want to add a WMS layer which are being serviced in Geoserver &
So, I changed javascript.

       function init(){
            OpenLayers.DOTS_PER_INCH = 90.714;
            var bounds = new OpenLayers.Bounds(
                 199628.88671875, 396702.2890625,
                 239834.30078125, 431934.58125
            var options = {
                controls: [],
                maxExtent: bounds,
                maxScale: 10,
                minScale: 500000,
                maxResolution: "auto",
                projection: "EPSG:4326",
                units: 'm'

            map = new OpenLayers.Map('map', options);
           //WMS base layer
            var base_wms = new OpenLayers.Layer.WMS(
                "topp:bml_gadm_as_w - Untiled",
                {layers: 'topp:bml_gadm_as_w'},
                {singleTile: true, ratio: 1}

           // OpenLayers 2.5 TMS driver
            var layer = new OpenLayers.Layer.TMS( "TMS",
                 {layername: '.', serviceVersion: '.', type:'png'} );

           //WMS river layer
            var river_wms = new OpenLayers.Layer.WMS(
                "topp:bml_rivr_as_w - Untiled",
                    layers: "topp:bml_rivr_as_w",
                    transparent: "true", format: "image/png"},
                {singleTile: true, ratio: 1,minScale:"100000"}

            map.addControl(new OpenLayers.Control.PanZoomBar());
            map.addControl(new OpenLayers.Control.Navigation());
            map.addControl(new OpenLayers.Control.Scale($('scale')));
            map.addControl(new OpenLayers.Control.MousePosition({element:
            map.addControl(new OpenLayers.Control.LayerSwitcher());

But, the problem is that tiled images do not match WMS layer. The tiled
images are aerial photos of the same area.
I don't understand exactly the projection. is this projection problem?
Could you give some advice.

Best regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080910/94355c0e/attachment-0001.html

More information about the gdal-dev mailing list