Increase the tile cache size for map perspective component

Hi
Is it possible to increase the tile cache size for map perspective component?
And where perspective store these files on gateway?

I want to increase tile cache and surf the area on different zoom, so perspective download map tiles and copy cache tiles to another gateway, so perspective map works offline for desired area.

Hi @nader.chinichian, the caching is all done client-side as you interact with the map, so nothing is saved to the gateway. The tiles are fetched from a tile server. https://www.openstreetmap.org/ is used by default (you can find this under the default layers.raster.tile[0] property entry), so it does require at internet connection to fetch tiles. There is no offline support, currently <-- EDIT: Sorry, not true. Offline support is currently possible but requires infrastructure on your side. See below.

1 Like

Hi Joshua
Does IA have any plan to support offline mode?
If caching is done in client, there must be some setting in client that how much tiles it store before overwriting tile for new one. Is there any way to access this setting via scripting?

If IA can’t provide offline support, you could try hosting an openstreetmap server locally on your gateway

https://switch2osm.org/fr/servir-des-tuiles/

2 Likes

A solution to test:

3 Likes

I opened a feature request for providing offline support. There are some caching strategies that we can put in place to help make an offline experience very responsive, but you will need to spin up a server on your network to host the map files. This is something you can do now to get offline support. You can get an export from Openstreetmap: https://www.openstreetmap.org/export#map=8/39.828/-114.760

Can we clarify something here? Usually when we talk about “Off-Line Mode” we mean that the client (browser or mobile app) cannot communicate with the Ignition Gateway. Is this what is being discussed here?

Or is it that we’re talking about cases where the client can communicate with the gateway, but that it doesn’t have internet access to get to the tile server (and so, the idea would be that the Gateway becomes a tile server)

1 Like

Hi Carl
Thanks for joining this topic. We talk for second option.

What I really mean is the senario that both clients and gateways server should not access Internet. I need the gateway cache some small area so when client open map page they can see the area. I can do caching manually by moving and zoom the area that I what to see offline.
This like what happens in Google map app in phone.
For example take a look at Kymera system map module.
They cache tiles in ignition folder in gateway and there is option to increase the size of tiles which is cached by server.
The client simply use this tiles from server ( client doesn’t connect to internet to download tiles)
I use this method for kymera map module and it works fine for me.

Another technique is make option like Google map app in Mobile phone to download map for offline usage.

If the Gateway cannot access the Internet, how is it expected to fill this tile cache?

Simple like the Google map app the first time server connect to internet and cache map and after it move to site it disconnect form internet.

Even Google map, cache the last area that user surf, so if you are offline you can see that area.

Another method is to have some sort of facility to download desire area and copy that files to gateway.
For real example take look at this:
https://www.google.com/url?sa=t&source=web&rct=j&url=https://www.oruxmaps.com/cs/en/&ved=2ahUKEwjSw9TCw4PlAhWuxoUKHbrAD9AQFjAAegQIAhAB&usg=AOvVaw2KP1og04Bn5Hr8KGeW046B

This Android app even has a windows tools for downloading map and moving that to phone.

Ok, I think I understand. I think your best bet in the short term would be to set up your own local tile server using a solution like the one linked by @mazeyrat

1 Like

Of course. Mean while I really want to know is there any plan for adding offline feature in future? Specially before releasing 8.1.0

when I download *.OSM exported file how can I use it in perspective map?

I don’t think you can use directly osm file.
These kind of file are raw data for a Tile server.
The role of the tile server is to provide Tiles (png image) for the lat/long, zoom and layers the client request. Perspective component is a map client.

OSM file => Tile Server (local or web hosted) <=> Perspective map component

When you use a map component in vision, you connect to a web tile server.
The component has some tile cache feature to store last visited tiles on the client or on the gateway to avoid requesting the same data multiple times.

To obtain offline support (no internet access) your tile server has to be “local”.

As a side note:
With open street map, if you don’t wan’t to host a full tile server in charge to generate the tiles from the client request, you can generate tile files (pictures file in .png) for all zoom level and for a limited area and store theses tiles file in a web server (igntion gateway web server for example). The client will request directly the tiles files of the web server.
We have done such of component for vision with this kind of “offline” support.

@Carl.Gould
Perhaps perspective map component can be configured to request directly tile files provided by ignition gateway webserver ?

Hi Lionel

I find a software that create png tile for offline usage. what I can’t figure it out there is a lot of format for doing that. could you please take a look at it and if possible guide me how and where to put these files in client or gateway for perspective map.

https://mobac.sourceforge.io/

For exporting maps from Open Street Map, you should use:
http://maperitive.net

and put the files in:

C:\Program Files\Inductive Automation\Ignition\webserver\webapps\main\tiles

with the directory {z}/{x}/{y}

In perspective, you will have to change the tile url:

From:

https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png

To:

http://W.X.Y.Z:8088/main/tiles/{z}/{x}/{y}.png

and set the right init.center.lat/lng according to the data you have provided.

7 Likes

Hi Lionel
Regard your solution I have some questions:
1 - The generate files from http://maperitive.net/ only include zoom level folder and a tiles.json file. so what do mean by “with the directory {z}/{x}/{y}”?
Do you mean something like this and copy all files into it:
C:\Program Files\Inductive Automation\Ignition\webserver\webapps\main\tiles\ {z}\ {x}\ {y}
2 - What is meaning of W.X.Y.Z in http://W.X.Y.Z:8088/main/tiles/{z}/{x}/{y}.png ? I think I should replace W.X.Y.Z with my gateway IP address.

Yes you need to generate all Tiles with zoom levels you need.
Tiles Can be serves by ignition built in web server. Replace W.x.y.z with your gateway IP address

Hi again
Sorry for bothering you, but the result from maperitive doesn’t include any {x}, {y} or {z} folder. So I’m little confuse with “with the directory {z}/{x}/{y}” you mentioned.

When tiles are generated, you can find them in the directory: Maperitive\Tiles/{z}/{x}/{y}.png

1 Like