0

I have two servers:

the first server is 177 and that has a html file with the TMS layer.

We will call this tms_layer.html and it has your init function with this in there:

var tmsoverlay = new OpenLayers.Layer.TMS( "TMS Overlay", "",
  {
    serviceVersion: '.', layername: '.', alpha: true, type: 'JPG', getURL:   
    overlay_getTileURL, isBaseLayer: true
  });

When i go to 177/tms_layer.html the tiles are being correctly displayed.

So that is working fine.

Now, I want to serve that tms_layer.html file on a different server (server 190), and I have been trying to serve it as a WMS layer. Not sure if WMS is the best approach but I think it is. Correct me if I'm wrong.

We'll call this tiles_revision1.html and within the init function I currently have:

layer = new OpenLayers.Layer.WMS( "My TMS layer in WMS",
  "http://177/dev/tiles/tiles_1a.html", {layers: ['tmsoverlay'], transparent: "true", format: "image/jpg"} );
map.addLayer(layer);

For the layers: [] do I even need to reference this since it's just a bunch of jpgs making up the tile(s)/map? Leaving it blank has not done anything.

With the above code I currently get a blank OL map, see here (When I pan around the map I get a Uncaught TypeError: cannot read property 'wrapDateLine' of null. I don't think that is the root of my issue though):

Edit: the most important thing here is to be able to access those 177 tiles from anywhere as a baselayer. There is quite a few associated jpgs, and the tms_layer.html file is pretty beefy on its own.

What is the correct way to do this?

1
  • 1
    I'm having trouble understanding why you want to access the tile Cache as an WMS Layer. It won't work without an actual WMS service running on the 117 server. What you need to do is to access it as an TMS layer from the new server as well. Commented Oct 30, 2013 at 2:52

1 Answer 1

1

Like Devdatta Tengshe suggested, you have to configure a TMS layer in tiles_revision1.html.

var tmsoverlay = new OpenLayers.Layer.TMS( 
    "TMS Overlay", 
    "http://url_to_177/",
    {
        serviceVersion: '.', 
        layername: '.', 
        alpha: true, 
        type: 'JPG', 
        getURL: overlay_getTileURL, 
        isBaseLayer: true
    });

If you still want (or need) to access the tiles via a WMS, you will have to setup a WMS service. If that so, look for one of these:

2
  • Thanks for the reply. The thing is the js function overlay_getTileURL is defined within tiles_1a.html on 177 and there's some other somewhat lengthy javascript defined in that file. How do I accommodate for that, as I don't want to be repeating myself everytime?
    – Nubtacular
    Commented Oct 30, 2013 at 15:34
  • 1
    You will need to take the javascript out of the html file and put it in a .js file. Then you will include this javascript file in tiles_1a.html and tiles_revision1.html like this: <script src="http://url_to_177/your_js_file.js"></script> Commented Oct 30, 2013 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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