Can't print maps with any layer except OSM basemap

70 views
Skip to first unread message
Assigned to lorenzo...@geosolutionsgroup.com by me

Scott Whittaker

unread,
Oct 2, 2024, 3:58:13 AM10/2/24
to mapstore-developers
If I make a map which has only the default OpenStreetmap layer and no other layers, I can print the map.

If I change the basemap to anything else (including the default OpenTopomap or any of our externally hosted basemaps) printing fails with an error.

If I use the default OSM basemap and show any overlay layer on it, printing fails with an error.

The error is always the same format. Here is an example of the error using OpenTopomap base layer:

Error on printing: Error while generating PDF: org.mapfish.print.InvalidJsonValueException: spec.layers[0].baseURL has an invalid value: https://a.tile.opentopomap.org/ (spec.layers[0].baseURL has an invalid value: https://a.tile.opentopomap.org/) at org.mapfish.print.map.readers.HTTPMapReader.checkSecurity(HTTPMapReader.java:137) at...

According to this post, it sounds like it might be security issue:

I have found and edited the file geoserver_data/data/printing/config.yaml and added URLs for the basemap servers and the local GeoServer URLs, but nothing seems to have any effect.

Here is what I've manually added to geoserver_data/data/printing/config.yaml:

  - !dnsMatch
    host: a.tile.opentopomap.org
    port: 80
  - !dnsMatch
    host: mahere.groundtruth.co.nz/geoserver
    port: 80
  - !dnsMatch
    host: mahere.groundtruth.co.nz/geoserver/ows?
    port: 80
  - !dnsMatch
    host: tiles.maps.linz.io
    port: 80

How do we fix this error?

Thanks,

Scott

Lorenzo Natali

unread,
Oct 3, 2024, 4:02:39 AM10/3/24
to mapstore-developers
Not sure, but I know that https default port is 443. 
You can try to change the ports.

Lorenzo Natali

unread,
Oct 3, 2024, 4:12:49 AM10/3/24
to mapstore-developers
Ah,
dnsMatch by the way is a system to limit the severs you are allowed to use.
It is not mandatory, and by default MapStore do not limit them. So if you had a problem with default configuration, I'm not sure it is related to `dnsMatch`.

If you are customizing the print configuration, you can refer documentation here.
http://www.mapfish.org/doc/print/

Simon Nitz

unread,
Oct 4, 2024, 9:09:37 AM10/4/24
to mapstore-...@googlegroups.com

Hi Scott

Try taking the port 80 out as that is for http when the services you are hitting are actually https (I haven’t found a need to put in the port value in our setup)

Something like this…

 

    host: a.tile.openstreetmap.org

  - !dnsMatch

    host: b.tile.openstreetmap.org

  - !dnsMatch

    host: c.tile.openstreetmap.org

  - !dnsMatch

    host: d.tile.openstreetmap.org

 

  - !dnsMatch

    host: tiles-a.data-cdn.linz.govt.nz

  - !dnsMatch

    host: tiles-b.data-cdn.linz.govt.nz

  - !dnsMatch

    host: tiles-c.data-cdn.linz.govt.nz

  - !dnsMatch

    host: tiles-d.data-cdn.linz.govt.nz

 

  - !dnsMatch

    host: basemaps.linz.govt.nz

 

Cheers

Simon

 

Simon Nitz

GeoSpatial Lead

Whanganui District Council

https://geospatial.whanganui.govt.nz/

--
You received this message because you are subscribed to the Google Groups "mapstore-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapstore-develo...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mapstore-developers/735a8b8a-b04e-4efc-8af3-892bb7320342n%40googlegroups.com.

Scott Whittaker

unread,
Oct 7, 2024, 3:36:47 AM10/7/24
to mapstore-developers
Thanks, I removed the port: 80 from the server lists, but it had no effect.

@Lorenzo, I'm not trying to do any customisation to the print settings except those required to get printing to work.

Here are my base layer definitions in local_settings.py in case there is anything that needs modifying there:

    DEFAULT_MS2_BACKGROUNDS = [
        {
            "type": "tileprovider",
            "title": "LINZ Aerial",
            "provider": "custom",
            "name": "LINZ:Aerial",
            "group": "background",
            "thumbURL": f"{SITEURL}static/mapstorestyle/img/s2cloudless-s2cloudless.png",
            "visibility": True,
            "url": "https://tiles.maps.linz.io/nz_aerialimagery_basemap/GLOBAL_MERCATOR/{z}/{x}/{y}.png",
            "options": {
                "maxZoom": 19,
                "maxNativeZoom": 19
            }
        },
        {
            "type": "tileprovider",
            "title": "LINZ Topographic",
            "provider": "custom",
            "name": "LINZ:Topographic",
            "group": "background",
            "thumbURL": f"{SITEURL}static/mapstore/dist/MapStore2/web/client/plugins/background/assets/img/OpenTopoMap.jpg",
            "visibility": False,
            "url": "https://tiles.maps.linz.io/nz_topo_basemap/GLOBAL_MERCATOR/{z}/{x}/{y}.png",
        },
        {
            "type": "tileprovider",
            "title": "LINZ Graphic",
            "provider": "custom",
            "name": "LINZ:graphic",
            "group": "background",
            "thumbURL": f"{SITEURL}static/mapstorestyle/img/s2cloudless-s2cloudless.png",
            "visibility": False,
            "url": "https://tiles.maps.linz.io/nz_colour_basemap/GLOBAL_MERCATOR/{z}/{x}/{y}.png",
        },
        {
            "type": "osm",
            "title": "Open Street Map",
            "name": "mapnik",
            "source": "osm",
            "group": "background",
            "visibility": False,
        },
        {
            "type": "tileprovider",
            "title": "OpenTopoMap",
            "provider": "OpenTopoMap",
            "name": "OpenTopoMap",
            "source": "OpenTopoMap",
            "group": "background",
            "visibility": False,
        },

    ]

    MAPSTORE_BASELAYERS = DEFAULT_MS2_BACKGROUNDS

The only difference I can see here is that Open Street Map, the only layer that will print, has no "provider" value.

Also, with Open Street Map as the base layer, if I add any GeoNode created layer on top of that, I get the same error on that overlay layer.

Scott Whittaker

unread,
Oct 7, 2024, 3:36:51 AM10/7/24
to mapstore-developers
Well it looks like the "provider" attribute is unnecessary, but removing it did not fix the printing.

On Saturday, October 5, 2024 at 2:09:37 AM UTC+13 Simon Nitz wrote:

Scott Whittaker

unread,
Oct 7, 2024, 3:36:55 AM10/7/24
to mapstore-developers
OK progress!

I've fixed the initial error with the base layers, except now when I get to the second screen of the print UI (print preview) none of the satellite images are rendered, though the other base layers are. There is also some inconsistency there, I've seen some (non-satellite) previews with a mosaic of some tiles renedering and some not.

The GeoNode overlays are rendering now too, so it's just this one issue with the satellite basemaps left to solve!

Here is my current config.yml:

hosts:
  - !ipMatch
    ip: 127.0.0.1
  - !dnsMatch
    host: localhost
  - !dnsMatch
    host: mahere.groundtruth.co.nz
  - !dnsMatch
    host: mahere.groundtruth.co.nz/geoserver
  #- !localMatch
  #  dummy: true
  #- !acceptAll
  #  dummy: true
 
  - !dnsMatch
    host: tile.openstreetmap.org
  - !dnsMatch

    host: a.tile.openstreetmap.org
  - !dnsMatch
    host: b.tile.openstreetmap.org
  - !dnsMatch
    host: c.tile.openstreetmap.org
  - !dnsMatch
    host: d.tile.openstreetmap.org

  - !dnsMatch
    host: tile.opentopomap.org
  - !dnsMatch
    host: a.tile.opentopomap.org
  - !dnsMatch
    host: b.tile.opentopomap.org
  - !dnsMatch
    host: c.tile.opentopomap.org
  - !dnsMatch
    host: d.tile.opentopomap.org

  - !dnsMatch
    host: api.mapbox.com
  - !dnsMatch
    host: api.mapbox.com/styles/v1/mapbox/satellite-streets-v9/tiles
  - !dnsMatch
    host: api.mapbox.com/styles/v1/mapbox/streets-v9/tiles

  - !dnsMatch
    host: tiles-a.data-cdn.linz.govt.nz
  - !dnsMatch
    host: tiles-b.data-cdn.linz.govt.nz
  - !dnsMatch
    host: tiles-c.data-cdn.linz.govt.nz
  - !dnsMatch
    host: tiles-d.data-cdn.linz.govt.nz
  - !dnsMatch
    host: basemaps.linz.govt.nz
  - !dnsMatch
    host: tiles.maps.linz.io

and here is my local-settings.py:

    DEFAULT_MS2_BACKGROUNDS = [
        {
            "type": "tileprovider",
            "title": "LINZ Aerial",
            "provider": "custom",
            "name": "LINZ:Aerial",
            "group": "background",
            "thumbURL": f"{SITEURL}static/mapstorestyle/img/s2cloudless-s2cloudless.png",
            "visibility": True,
            "url": "https://basemaps.linz.govt.nz/v1/tiles/aerial/EPSG:3857/{z}/{x}/{y}.webp?api=d01ee9cf2aabwh5xz1qv27d136n",
        },
        {
            "type": "tileprovider",
            "title": "Mapbox Satellite",
            "provider": "custom",
            "name": "Mapbox:Satellite",

            "group": "background",
            "thumbURL": f"{SITEURL}static/mapstorestyle/img/s2cloudless-s2cloudless.png",
            "visibility": False,

        },
        {
            "type": "tileprovider",
            "title": "LINZ Topographic",
            "provider": "custom",
            "name": "LINZ:Topographic",
            "group": "background",
            "thumbURL": f"{SITEURL}static/mapstore/dist/MapStore2/web/client/plugins/background/assets/img/OpenTopoMap.jpg",
            "visibility": False,
On Saturday, October 5, 2024 at 2:09:37 AM UTC+13 Simon Nitz wrote:

Scott Whittaker

unread,
Oct 7, 2024, 3:36:58 AM10/7/24
to mapstore-developers
One thing I noticed on the second page print preview of the maps with a satellite base layer is a little ? icon in the corner that when hovered shows the following error:

<p>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br>java.lang.IllegalStateException: unsupported protocol: 'jar'<br></p>

I'm not sure if that's helpful?

Scott


On Saturday, October 5, 2024 at 2:09:37 AM UTC+13 Simon Nitz wrote:

Simon Nitz

unread,
Oct 8, 2024, 9:08:10 AM10/8/24
to mapstore-...@googlegroups.com

Is there any more detail in the geoserver logs?

Simon

Reply all
Reply to author
Forward
0 new messages