Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for WMTS tile map service #1855

Closed
rsimon opened this issue Jul 15, 2020 · 7 comments
Closed

Add support for WMTS tile map service #1855

rsimon opened this issue Jul 15, 2020 · 7 comments

Comments

@rsimon
Copy link
Contributor

rsimon commented Jul 15, 2020

WMTS is a service for georeferenced maps, served as image tiles. It's very similar to the TMS specification, which is already supported.

It seems that the only change to the TMS tilesource implementation that's needed to make it a WMTS implementation is this:

// Original TMS implementation (tmstilesource.js, line 128)
getTileUrl: function( level, x, y ) {
  var yTiles = this.getNumTiles( level ).y - 1;
  return this.tilesUrl + level + "/" + x + "/" + (yTiles - y) + ".png";
}

// Changed to...
getTileUrl: function( level, x, y ) {
  return this.tilesUrl + level + "/" + x + "/" + y + ".png";
}

Therefore I wonder if WMTS could be made a config option to the TMS tilesource?

@iangilman
Copy link
Member

Sounds great! What do you think would be a good API for it?

According to our demo (which needs a new demo tile source, by the way, if you know of one!), here's an example TMS:

{
  type:       'tiledmapservice',
  tilesUrl:   'http://tilecache.osgeo.org/wms-c/tilecache.py/1.0.0/basic/',
  width: 256 * 65534,
  height: 256 * 32767
}

So maybe we support WMTS like so?

{
  type:       'webmaptileservice',
  tilesUrl:   'http://tilecache.osgeo.org/wms-c/tilecache.py/1.0.0/basic/',
  width: 256 * 65534,
  height: 256 * 32767
}

I suppose we could also do something like this:

{
  type:       'tiledmapservice',
  tilesUrl:   'http://tilecache.osgeo.org/wms-c/tilecache.py/1.0.0/basic/',
  width: 256 * 65534,
  height: 256 * 32767, 
  flipY: false
}

… But I think that could be confusing for people just coming looking for WMTS without knowing the implementation details.

Either way, we can lean heavily on the TmsTileSource for implementation.

Sound good? Are you up for making a pull request around this? If so, I'm happy to provide guidance. Otherwise, hopefully someone else will pick up the torch.

@rsimon
Copy link
Contributor Author

rsimon commented Jul 22, 2020

I thought about this a little. How about a property called protocol which could either be tms or wmts? If we default to tms, everything stays compatible to the way things are now.

Incidentally, 'TMS' is the acronym of Tile Map Service, not tiled (i.e. the current tile source key tiledmapservice is - if you're nitpicky - wrong). Therefore, we can argue that both TMS and WMTS are protocols for tiled map delivery. So the name can stay as an appropriate umbrella term, and even though we wouldn't change anything, the naming would actually be correcter than before :-)

@iangilman
Copy link
Member

Nice. Well, that sounds reasonable to me.

Are you up for making it happen? Sounds like it'll just be a small change to TmsTileSource, plus some documention.

Also, do you know of any sample files out there in these formats that we can use for the demo page?

@rsimon
Copy link
Contributor Author

rsimon commented Jul 23, 2020

Yes, more than happy to attempt a pull request for that. (Might take a week or so until I can start looking into this though.)

I'll also look for good example layers to post on the website.

@iangilman
Copy link
Member

Awesome, thank you! No worries on the timing, of course :-)

@rsimon
Copy link
Contributor Author

rsimon commented Mar 7, 2021

Hi,

finally revisited this after a long time. In the end, I think it's not possible to implement useful WMTS support purely with a tilesource.

  1. WMTS have an XML "manifest" which needs to be loaded before, and which defines the properties of the tilesource.
  2. there's also the issue of dealing with geo-coordinates.

The first issue, I assume, could be handled somehow (after all, IIIF manifests work in a similar way). But because of the second issue, I thought this might be easier/better to handle via a plugin.

I made a first version here:
https://github.com/recogito/openseadragon-wmts

Would be interested to hear your feedback!

@msalsbery
Copy link
Member

Even DZI images have an XML “manifest” so I wouldn’t think that’s an issue...

I personally think all tile sources should be plugins so developers can just pull in the ones they use.

Very cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants