Openlayers doesn't load tiles beyond zoom level 18?

920 views
Skip to first unread message
Assigned to bovio....@gmail.com by me

rususo...@gmail.com

unread,
Mar 17, 2021, 3:02:15 PM3/17/21
to mapstore-developers
Hey,

I've been trying to use Mapstore to publish some old maps of my home city of Iași in Romania. I've used QGIS to generate XYZ tiles caches from the old maps, and I am serving those caches from a HTTP server

I'm encountering an issue where configuring webmaps, using the OpenLayers library, in which I'm loading the custom XYZ TMS services, the webmap will refuse to request any tiles that are beyond zoom level 18, the map just "enlarges" the already downloaded level 18 tiles. Is this behavior hard-coded for the OpenLayers implementation in Mapstore? I am reasonably sure that the OL library supports zoom levels beyond lvl 18, correct?

The same webmap, rendered through leaflet doesn't have this issue, and when zooming in gets the lvl-19 tiles perfectly

You can test this live:

You can also test this locally using the following new.json configuration:
{
  "version": 2,
        "map": {
    "projection": "EPSG:900913",
                "units": "m",
                "center": {"x": 1250000.000000, "y": 5370000.000000, "crs": "EPSG:900913"},
    "zoom":19,
                "maxExtent": [
                        -20037508.34, -20037508.34,
                        20037508.34, 20037508.34
                ],
                "layers": [
{
    "type": "tileprovider",
    "title": "osm-lvl19",
    "provider": "custom",
    "name": "Name",
    "group": "background",
    "visibility": true,
    "url": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
    "options": {
        "subdomains": [ "a", "b"],"maxNativeZoom":19  }}  ]    } }

With the above configuration if you open a new map in mapstore, I see that :
http://localhost:8081/#viewer/openlayers/new - doesn't get any lvl 19 tiles, just enlarges the lvl18 ones, while  http://localhost:8081/#viewer/leaflet/new - works perfectly and gets the lvl19 tiles.

Any ideas on this behavior? I would really like to use Openlayers as the SpyGlass is an amazing tool for this type of "old" map digital publishing, and it isn't available in Leaflet.

Thanks in advance,

Sorin


Stefano Bovio

unread,
Mar 18, 2021, 8:09:55 AM3/18/21
to mapstore-...@googlegroups.com
Hi Sorin,

we double checked on your instance and seems that your map configuration did not stored the maxNativeZoom in the saved map

image.png

so your demos are not using the maxNativeZoom and the different behaviour between openlayer and leaflet is due to the default configuration:

- maxZoom in leaflet is 23 and maxNativeZoom(*)  undefined https://github.com/geosolutions-it/MapStore2/blob/v2021.01.01/web/client/components/map/leaflet/plugins/TileProviderLayer.js#L14
- maxZoom in openlayers is 18 and maxNativeZoom(*)  is not available as option https://github.com/geosolutions-it/MapStore2/blob/v2021.01.01/web/client/components/map/openlayers/plugins/TileProviderLayer.js#L25

  (*) only leaflet library use maxNativeZoom https://leafletjs.com/reference-1.7.1.html#gridlayer-maxnativezoom https://openlayers.org/en/latest/apidoc/module-ol_layer_Tile-TileLayer.html

To ensure to have the options in the layer you have to import again it from catalog after updating the Custom TMS Configuration and remove the existing layer from TOC:

- edit catalog
- update TMS Configuration
- save catalog
- import the layer in TOC
- save the map

You could use the maxZoom property to 19 to have both libraries aligned.

Hope this helps,

Stefano




--
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/23d8bddc-e868-48bc-a030-c8ffc7f25bb7n%40googlegroups.com.


--

Regards,

Stefano Bovio

==

GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information.

==

Stefano Bovio

Digital Cartographer - UI/UX Designer


GeoSolutions S.A.S.

Via di Montramito 3/A

55054  Massarosa (LU)

Italy

phone: +39 0584 962313

fax:     +39 0584 1660272


http://www.geo-solutions.it

http://twitter.com/geosolutions_it


-------------------------------------------------------


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.

rususo...@gmail.com

unread,
Mar 20, 2021, 4:39:17 AM3/20/21
to mapstore-developers
Thanks Steffano,

Thank you for your guidance and I will redo the webmaps this weekend, following your steps. I will be back with feedback.

rususo...@gmail.com

unread,
Mar 21, 2021, 4:37:33 PM3/21/21
to mapstore-developers
Hi Stefano,

I tried following your guidance, but I am getting mixed results. I am attaching my current new.json and localConfig.json, maybe you can provide any assistance:
Could you please provide some assistance to what I am doing wrong?

- the new.json has a couple of predefined "background" layers, all of them have the appropriate maxZoom and maxNativeZoom properties
- the localConfig.json has the Catalog defined with:
       - a WMS from our local Geoserver
       - a bunch of tiled XYZ layers (as well with the required properties);
       - the "static services" mirrors the background services in the new.json, properties and all;

When I now try to make a new map, everything works, up until I save the map. After successfully saving the map, if I try to access it again it, I see the map doesn't have the options attributes.

You can take a look at the webmap here (I left it free for everyone to edit): http://iasi-vechi.ddns.net/mapstore/#/viewer/openlayers/47

Looking at the response from http://iasi-vechi.ddns.net/mapstore/rest/geostore/data/47 i see that none of the layers in the "layers" object have the maxZoom or maxNative, but looking at the entries in the "catalog" object, all of them appear ok.

Bellow is an example of the behavior:
On the right: in a brand new map:
     - I add some background layers -> ok;
     - I add the old-map layer -> ok;
     - I save the map -> ok;
On the left: the map, after save, when I try to access it from the mapstore homepage:
right_beforesave_left_aftersave_plus_reload.PNG

Sorin R.

localConfig.json
new.json
Message has been deleted

rususo...@gmail.com

unread,
Mar 22, 2021, 5:21:03 PM3/22/21
to mapstore-developers
Hey,

An update to yesterday's post, I moved the backend geostore to our postgresql instance in Amazon just to be able to check what Mapstore saves in the geostore.gs_stored_data tables and every time I try to make a new map and save it, it doesn't seem to want to save the maxZoom or MaxNativeZoom options for the added layers.

I am resorted to manually edit in pgAdmin the gs_stored_data table, for the map entry, and manually add the options for the custom XYZ Tile Layer. Once the layer has the options, reloading the saved map finally renders LVL18+ PNGs correctly.

Obviously, any further "saves" to the map will result in Mapstore stripping the options arguments I manually edited via pgAdmin, but as long as I am able to keep this map "fixed" it is a working, yet ugly work-around.

I am starting to think this is a bug?



On Sunday, March 21, 2021 at 10:43:01 PM UTC+2 rususo...@gmail.com wrote:
If you require it, I created a testing user with "USER" role, that you can use:
username: testing
pwd:           testing
manually_editing_gs_tables.PNG

Stefano Bovio

unread,
Mar 23, 2021, 6:38:02 AM3/23/21
to mapstore-...@googlegroups.com
Hi Sorin,


I am starting to think this is a bug?

Yes, it seems a bug, yesterday a colleague opened an issue related to this 
and your investigation confirm the bug.
We took a look on the utils that save the configuration for the layers object and it seems that the options property is not there:

https://github.com/geosolutions-it/MapStore2/blob/v2021.01.01/web/client/utils/LayersUtils.js#L487-L540

but instead we have maxZoom and minNativeZoom in the root of the object

https://github.com/geosolutions-it/MapStore2/blob/v2021.01.01/web/client/utils/LayersUtils.js#L516-L517 

thanks again for you feedback and investigation,
you can keep track on the state of the issue or contribute to it here https://github.com/geosolutions-it/MapStore2/issues/6684

Stefano

--
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.

Stefano Bovio

unread,
Mar 23, 2021, 6:54:15 AM3/23/21
to mapstore-...@googlegroups.com
Hi Sorin,

Another solution is to use the visibility limits in the layer settings ui instead.
The list of scales or resolutions you find in the select are the value for each zoom level of the map
and there is also an arrow that indicates which scale is using the current zoom level.

https://mapstore.readthedocs.io/en/latest/user-guide/layer-settings/#display

The value you select are converted to minResolution and maxResolution in the layer object
and they should be currently supported in the save process.

image.png

Hope this help,

Stefano


Reply all
Reply to author
Forward
0 new messages