jeffersonheard / ga_bigboard

The Big Board - teleconferencing over maps
Other
7 stars 2 forks source link

Overlays with fixed resolutions #4

Closed NathanRSmith closed 12 years ago

NathanRSmith commented 12 years ago

We have a tilecache instance that caches a mapserver wms at certain resolutions (powers of 2). Adding this as an overlay causes a 404 (Tile not found) error with the following text:

An error occurred: can't find resolution index for 38.218514. Available resolutions are: 
[1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0, 512.0, 1024.0, 2048.0, 4096.0, 8192.0, 16384.0, 32768.0, 65536.0]

Any way to have open layers request the closest resolution and scale appropriately?

NathanRSmith commented 12 years ago

Default creation options used:

{
    url:'http://cybereye.crc.nd.edu/portal/tilecache/',
    layers:'Hawaii_Base',
    format:'image/png',
    transparent:'true',
    resolutions:[
      1,
      2,
      4,
      8,
      16,
      32,
      64,
      128,
      256,
      512,
      1024,
      2048,
      4096,
      8192,
          16384,
      32768,
      65536
    ],
    maxExtent:new OpenLayers.Bounds(-17880970, 2123200, -17215840, 2552800),
    transitionEffect: 'resize'
}
jeffersonheard commented 12 years ago

This should probably be a different kind of Overlay. What kind of service is the tilecache? WMTS? If so, we can add that as an Overlay type. I'd just not run into it before. Look at OpenLayers.org and look in the API doc in the Layer subheading and let me know what class fits best.

On Fri, Jul 27, 2012 at 2:40 PM, Nathan Smith < reply@reply.github.com

wrote:

We have a tilecache instance that caches a mapserver wms at certain resolutions (powers of 2). Adding this as an overlay causes a 404 (Tile not found) error with the following text:

An error occurred: can't find resolution index for 38.218514.

Available resolutions are: [1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0, 512.0, 1024.0, 2048.0, 4096.0, 8192.0, 16384.0, 32768.0, 65536.0]

Any way to have open layers request the closest resolution and scale appropriately?


Reply to this email directly or view it on GitHub: https://github.com/JeffHeard/ga_bigboard/issues/4

NathanRSmith commented 12 years ago

It is a WMS-C/TMS service, just at specific resolutions. Tilecache isn't really supported anymore and doesn't do WMTS as it should, and we would like to move to something else, but for now it is what we have.

jeffersonheard commented 12 years ago

http://dev.openlayers.org/releases/OpenLayers-2.12/examples/tilecache.html - this should help to fix the bug.

jeffersonheard commented 12 years ago

Sure, Nathan, and that's fine. How big a deal is this right now? Is this something you could fix, or do I need to look into it?

NathanRSmith commented 12 years ago

No need to do anything about it right now, I can tackle it when needed.

NathanRSmith commented 12 years ago

Fixed this by using the following configuration:

{
    "url": "http://cybereye.crc.nd.edu/portal/tilecache/",
    "layers": "Hawaii_Base",
    "isBaseLayer": false,
    "format": "png",
    "singleTile": false,
    "serverResolutions": [
                            65536,
                            32768,
                            16384,
                            8192,
                            4096,
                            2048,
                            1024,
                            512,
                            256,
                            128,
                            64,
                            32,
                            16,
                            8,
                            4,
                            2,
                            1
                        ],
    "maxExtent": new OpenLayers.Bounds(-17880970, 2123200, -17215840, 2552800),
    "transparent": true,
    "transitionEffect":"resize"
}

Resolutions needed to specified as "serverResolutions" and be in descending (not ascending) order. This can also work as a base layer by changing that option to true.

The only problem is that these resolutions don't exactly match standard zoom levels, which could be changed in tilecache, which causes the layer images to appear blown up from a lower resolution (which they were). It may be be useful to add some fields to the room model to set the OL map configuration such as resolutions, maxExtent, minExtent, etc.