Bug#944974: gdal-bin: gdal2tiles.py option --webviewer=leaflet does nothing.

Witold Baryluk witold.baryluk at gmail.com
Sun Nov 17 22:04:52 GMT 2019


Package: gdal-bin
Version: 2.4.3+dfsg-1
Severity: normal

I did run gdal2tiles.py on big PNG input in raster mode and gdal2tiles
generated only tilemapresource.xml , no leaflet viewer skeleton when I
used --webviewer=leaflet.

There are no HTML / JS / CSS files in the current working directory or in
the directory with tiles.

Looking at the source code it looks like the included leaflet viewer only
supports mercator profile, not raster. I know leaflet does support raster
/ cartesian layers, so this simply looks like a bit of missing code
(actually way less than the one for the mercator) to add, but maybe there
is some other reason behind it.

This might be a good start:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <title>{title}</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"
    integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
    crossorigin=""/>
  <script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"
   integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og=="
   crossorigin=""></script>
</haad>
<body>
<div id="mapid" style="width: 1600px; height: 1000px;"></div>
<script>
var yx = L.latLng;

// Helper function to conver to leaflet coventions.
var xy = function(x, y) {
  if (L.Util.isArray(x)) {    // When doing xy([x, y]);
    return yx(x[1], x[0]);
  }
  return yx(y, x);  // When doing xy(x, y);
};

document.addEventListener('DOMContentLoaded', (event) => {
  // In a CRS.Simple, one horizontal map unit is mapped to one horizontal
  // pixel, and idem with vertical. This means that the whole map is about
  // 1000x1000 pixels big and won’t fit in our HTML container. Luckily, we
  // can set minZoom to values lower than zero.

  var map = L.map('mapid', {zoomSnap: 0.25, zoomDelta: 0.5, crs: L.CRS.Simple, minZoom: -5, maxZoom: 10});  // Square cartesian grid for coordinate reference system.

  map.setView([30000, 30000], 0);  // [y, x]

  L.tileLayer('{outputdir}/{z}/{x}/{y}.png', {
    attribution: '{copyright}',
    maxZoom: {maxzoom},
  }).addTo(map);
});
</script>
</body>
</html>


Cheers,
Witold



-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.2.0-3-amd64 (SMP w/32 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gdal-bin depends on:
ii  libc6                               2.29-3
ii  libgcc1                             1:9.2.1-19
ii  libgdal20 [gdal-abi-2-4-0]          2.4.3+dfsg-1
ii  libstdc++6                          9.2.1-19
ii  python3                             3.7.5-1
ii  python3-gdal                        2.4.3+dfsg-1
ii  python3-numpy [python3-numpy-abi9]  1:1.16.5-1

gdal-bin recommends no packages.

Versions of packages gdal-bin suggests:
ii  libgdal-grass  2.4.3-2

-- no debconf information


More information about the Pkg-grass-devel mailing list