开发者

Merge TileCache Layers

I have a TileCache server with this configuration:

[cache]
type=Disk
base=/var/maps/cache

[osm]
type=Mapnik
mapfile=/var/maps/bin/mapnik/osm.xml
bbox=-180.0,-90,180.0,90
srs=EPSG:4326

[oge]
type=MapServerLayer
mapfile=/var/maps/defs/OGE.map
layers=OGETransLines

I am using OpenLayers to show the data and currently I have requesting the 'osm' layer with an OpenLayers.Layer.TMS object and the 'oge' layer with an OpenLayers.Layer.WMS object. Is there a way to merge the two together and request them at the same time? So far I have only been able to get the 'osm' layer with TMS.

EDIT: My Javascript to make things clearer:

map = new OpenLayers.Map("mapDiv",
                                  {
                                      proje开发者_JAVA百科ction: epsg4326,
                                      maxResolution: 360 / 512
                                  });

        baseLayer = new OpenLayers.Layer.TMS("TarigmaOSM",
                                              "http://1.1.1.1/cgi-bin/tilecache/tilecache.cgi/",
                                              {
                                                  serviceVersion: "1.0.0",
                                                  layername: "osm",
                                                  type: "png",
                                                  attribution: "Data CC-by-SA OpenStreetMap"
                                              });
        map.addLayer(baseLayer);

        overlay = new OpenLayers.Layer.WMS("Overlay",
                                            "http://1.1.1.1/cgi-bin/tilecache/tilecache.cgi?",
                                            {
                                                layers: "oge",
                                                transparent: "true",
                                                attribution: ""
                                            });
        map.addLayer(overlay);


There is no way you can do it on the client side. Every layer you create in OpenLayers makes it's own requests to fetch images.

Only possible solution is to create one WMS or TMS service on the server side that reads data from two data sources that you want to merge.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜