maptiler / tileserver-gl

Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
https://tileserver.readthedocs.io/en/latest/
Other
2.21k stars 635 forks source link

tileserver-gl raster tile attributions don't show up #1004

Closed boonboonsiri closed 1 year ago

boonboonsiri commented 1 year ago

Issue

I'm not sure if this is intentional, but the attributions (bottom right) doesn't show up for generated raster tiles. They show up in both the tilejson and leaflet map demo but doesn't show up for the actual rendered raster image.

image image image

Config used looks something like this


{
  "options": {
    "paths": {
      "root": "",
      "fonts": "fonts",
      "sprites": "sprites",
      "styles": "styles"
    },
    "maxScaleFactor": 3,
    "maxSize": 2048,
    "pbfAlias": "pbf",
    "serveAllFonts": true,
    "serveAllStyles": false,
    "serveStaticMaps": true,
    "allowRemoteMarkerIcons": false,
    "tileMargin": 0,
    "attribution": "radar upper"
  },
  "styles": {
    "radar-dark-v1": {
      "style": "radar-dark-v1.json",
      "tilejson": {
        "type": "baselayer",
        "attribution": "test"
      }
    }
  }
}

     

Reproduce

the default attribution also doesn't show up, not just the custom attribution and can be reproduced like this

wget https://github.com/maptiler/tileserver-gl/releases/download/v1.3.0/test_data.zip
unzip test_data.zip
docker run --rm -it -v $(pwd):/data -p 8080:8080 maptiler/tileserver-gl
[in your browser, visit http://[server ip]:8080]

and then the generated tile image has no attribution

image

About

Macos: 13.5.1 Docker: 4.24.0 TileserverGL: 4.5.1

acalcutt commented 1 year ago

You are right, static images don't have attribution.

In Vector view, TileJSON gets passed to maplibre-gl-js and it displays the attribution. In Raster view, maplibre-native does the rendering but leaflet is showing the attribution based on the TileJSON

In Static view however, Maplibre-Native is making the image and tileserver-gl is passing it back to the user. Maplibre-Native processes the TileJSON, but it doesn't include anything to display the attibution.

An workaround right now might be to use WATERMARK, which looks something like 249139753-3269cd8e-5942-4237-848d-8dbdf6a2567d

You could also read the tilejson for the style and display it in your own app, but that is a bit of a pain.

If we were to add attribution to static imges, we could possibly add code similar to watermark, which would draw the text over the image maplibre-native generates. https://github.com/maptiler/tileserver-gl/blob/master/src/serve_rendered.js#L760-L771

boonboonsiri commented 1 year ago

Ah okay okay yeah I'm open to many ideas. Just want to attribute everyone correctly.

If this PR satisfies your needs then I think this issue is good

acalcutt commented 1 year ago

Do you have any opinion on https://github.com/maptiler/tileserver-gl/pull/1005 ? do you think that would fix your needs. I plan to approve it, but like to hear what people think.

boonboonsiri commented 1 year ago

https://github.com/maptiler/tileserver-gl/issues/1004#issuecomment-1749716615 is perfect

boonboonsiri commented 1 year ago

Closed with https://github.com/maptiler/tileserver-gl/issues/1004#issuecomment-1749716615