These are chat archives for openseadragon/openseadragon

15th
Oct 2018
vin-dev
@vin-dev
Oct 15 2018 07:31
@iangilman I faced an issue with the tilecache functionality in IE11/Edge. In my analysis, this issue is not caused by OSD itself, but because of the memory consumed by the image/context canvas in these browsers is very high.My tile sizes are 1536*1536. For saving a single such tile in cache, IE11/Edge is using 9MB of memory. So as more images get loaded, the overall memory consumed increases leading to slowness. I fixed it by disabling tile cache in these browsers. Even though it is not an OSD specific issue, just curious to know, have you come across any such scenarios?.
galoulebougalou
@galoulebougalou
Oct 15 2018 14:07

Hi,

I'm facing issues with Tiledmapsource and any help would be welcome:
As I said I created a pyramid with GDAL2tiles and struggling to view it with OSD:
My First try:

<script type="text/javascript">
    // Example
    var viewer = OpenSeadragon({
        showNavigator:  true,
        id:              "contentDiv",
        prefixUrl:       "../openseadragon/images/",
        tileSources:     "eveche.dzi"
    });
viewer.scalebar({
  type: OpenSeadragon.ScalebarType.MAP,
  minWidth: 75,
  pixelsPerMeter: 59,
  location: 3,
  xOffset: 5,
  yOffset: 10,
  color: "rgb(255, 0, 0)",
  fontColor: "rgb(255, 0, 0)",
  stayInsideImage: false,
  barThickness: 3,
  });
</script>

OSD seems to load the pyramid but there's a confusion in the structure so that I've got manu "a.tile" errors (screenshot).

2nd try : Trying to pick a formula coming from the chat between @Iangilman and @bpirih_gitlab


<script type="text/javascript">
    // Example
    var viewer = OpenSeadragon({
        showNavigator:  false,
                wrapHorizontal:     false,
                zoomPerScroll:      1.2,
                minZoomLevel:         0.1,
                maxZoomLevel:        12,
                homeFillsViewer:    true,
                navigationControlAnchor:     OpenSeadragon.ControlAnchor.BOTTOM_RIGHT,
                //minZoomImageRatio:  0,
                //defaultZoomLevel:   ,
                //panHorizontal:         true,
                //panVertical:         true,
                //visibilityRatio:    1,
                //constrainDuringPan: true,
                debugMode:            true,
        id:              "contentDiv",
        prefixUrl:       "../openseadragon/images/",
        tileSources:   [{
        type:       'tiledmapservice',
        tilesUrl:   'http://localhost/altimetrix/examples/DurbanC/Open3/',
        tileSize: 256,
        width: 256 * 40858,
        height: 256 * 78943,
        minLevel: 0,
        maxLevel: 4,
        getTileUrl: function( level, x, y ) {
             // Convert from Deep Zoom definition to TMS zoom definition
             var yTiles = this.getNumTiles( level ).y - 1;

             level++;

             return this.tilesUrl + level + "/" + x + "/" + (yTiles - y) + ".png";
         }
    }],

     });
</script>

1st try:
![alt]https://photos.app.goo.gl/RnsjedwDRoioGr3bA
2nd:
![alt]https://photos.app.goo.gl/5Mxo144CAeHHNu4j7

Gadl2tiles file's structure:
[Link]https://drive.google.com/file/d/1vgdNeOxe7K5VzdPqe7zZRnuKBmkf8P8d/view?usp=sharing

Ian Gilman
@iangilman
Oct 15 2018 17:55
@jason-green-io Hmm... looks like that might take a little doing. One option is to use viewer.addControl() to add it to the viewer so it knows to fade it. You'll probably need to look in the code to learn about it, though, as our docs are pretty scarce there. Here's a place to start: https://github.com/openseadragon/openseadragon/blob/master/src/controldock.js#L97
The other option would be to manage your own fading and try to match what OSD does. Here's a place to start looking for that: https://github.com/openseadragon/openseadragon/blob/master/src/viewer.js#L2451
I think my recommendation would be to try to get it working via addControl first.
@vin-dev Actually 9mb for a 1536 by 1536 canvas seems about right... 153615364 (since canvas uses 4 bytes per pixel, RGBA) is 9,437,184. That may very well be how it is on every browser (unless they are doing something to compress canvas in memory). Did you not have trouble on other browsers? Did you look into their memory usage?
Ian Gilman
@iangilman
Oct 15 2018 18:05
Presumably we could slim that down by not using Canvas for the tiles when we don't need to (just using images). I actually don't recall why we moved to always using Canvas, though I think it's a performance optimization. Some discussion of that in here: openseadragon/openseadragon#1500
Ian Gilman
@iangilman
Oct 15 2018 18:26
@galoulebougalou I'm sorry, I really know very little about TMS, and as you've no doubt noticed, our TMS example is broken (because the data it points to has gone offline). My recommendation is to find somewhere where you can ask TMS specific questions. There must be experts out there!
If you understand the TMS format (and can explain it to me), I can help you get it connected.
Anyway, your code looks like it could work, but I don't know enough about the format to say what might be missing.
BTW, if you do find a good source for TMS info, I'd love to get our TMS demo hooked up to some live data again! Please let me know...
BTW, why are you using TMS? Would it be possible to use DZI instead? I know a lot more about that format...