geocollections / turvas

Database of peat geology
https://turba.geoloogia.info
1 stars 0 forks source link

Implement map tile cache #86

Open ollehints opened 3 years ago

ollehints commented 3 years ago

Loading peat area plans is very slow despite the GWC is enabled in geoserver and smaller zoom levels - at least 0-5 - are cached. The cached tiles should be served directly for wms requests, but that seems not to be the case. WMTS call 15-20 ms: http://gis.geocollections.info/geoserver/gwc/service/wmts?layer=turvas%3APlaanid&style=&tilematrixset=EPSG%3A3301L&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fpng&TileMatrix=EPSG%3A3301%3A5&TileCol=20&TileRow=12

WMS call 700-100 ms: https://gis.geocollections.info/geoserver/wms?service=WMS&request=GetMap&layers=turvas%3APlaanid&styles=&format=image%2Fpng&transparent=true&version=1.1.1&tiled=true&width=512&height=512&srs=EPSG%3A3301&bbox=632500.000000008,6424999.99999975,648500.0000000093,6440999.99999976

WMTS and TMS layers could be included in Leaflet as:

        {
          id: "Test",
          name: "Test",
          name_en: "Test",
          visible: true,
          leafletObject: L.tileLayer(
              "https://gis.geocollections.info/geoserver/gwc/service/wmts?layer=turvas%3APlaanid&style=&tilematrixset=EPSG%3A3301&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fpng&TileMatrix=EPSG%3A3301%3A{z}&TileCol={x}&TileRow={-y}",
              {
                // attribution:
                //   "<a href='http://www.maaamet.ee/' target='MapReferenceWindow'>&copy; Maa-amet</a>",
                detectRetina: false,
                updateWhenIdle: true,
              }
          )
        },
        {
          id: "Test1",
          name: "Test1",
          name_en: "Test1",
          leafletObject: L.tileLayer(
              "https://gis.geocollections.info/geoserver/gwc/service/tms/1.0.0/turvas:Turbapunktid@lest256@png/{z}/{x}/{y}.png",
              {
                // attribution:
                //   "<a href='http://www.maaamet.ee/' target='MapReferenceWindow'>&copy; Maa-amet</a>",
                tms: true,
                detectRetina: false,
                updateWhenIdle: true
              }
          )
        }, 

It seems that the tiles from different requests are not matching. For some reasons there is problem with coordinates - tiles are wrongly positioned. This may be related to CRS (3301 not well supported by leaflet), tile size, tileset origin, and allowed zoom levels etc.

Flickering of semi transparent images on load may perhaps be related to reprojecting etc in Leflet.

ollehints commented 3 years ago

Slow speed of other layers is due to the same problems. Creating correct gridsets requires additional research - thay have to match with each other and with base map layers from Land Board.