Increase the tile cache size for map perspective component

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

Thanks a lot. What a great solution. By the way it works with https://mobac.sourceforge.io/
So I can download other map source like Google maps with the format that you mentioned.

1 Like

Thanks a lot, @mazeyrat! Very cool :slight_smile: and SUPER simple. @Paul.Scott possible to add this into the IA user manual under the Perspective Map component?

I'm not super excited on the premise of storing things in the webserver\webapps\main\ directory, for two reasons.

  1. Our installers delete that directory on upgrade, so you'd need to be mindful about managing those tiles yourself on upgrade
  2. I'm not an expert on the matter, but my understanding of how files in that directory get served up is sort of a byproduct of some stuff Jetty does. Meaning, nothing we wrote in our code base is directly facilitating that behavior. The next time we upgrade Jetty, that functionality could just disappear.

Point #2 is a big part of the reason why the user manual doesn't really suggest putting things in that directory. I could see using a WebDev Mounted Folder or some other webserver to store the tiles, which the component page you suggested could mention.

2 Likes

Web dev is add to project for just simple serving some files. So please don’t disable that option for us.

Thanks Paul, I didn’t know that those files were deleted on upgrade, good to know!
I’ll see about adding the Web dev module to our customer’s licence. Thanks for the reply and the info

Sure thing. FWIW, might be worth looking at that self hosting OpenMapTiles link mazeyrat posted early in this thread. I haven’t had a chance to check it out yet, but seems promising.