Topic: Custom tile server overlay?

Hello,

I am really really new to Unity and the Online Maps, but come from having working some with mapbox-gl.

What's the best way to add a map layer from a custom tile server on top of the base map?

Here's one that I'm interested in: https://tiles.openseamap.org/seamark/${z}/${x}/${y}.png

(and more here: wiki.openstreetmap.org/wiki/Tile_servers)

Would I be able to cache/offline these as well?

Sorry if I'm asking silly questions, but I couldn't find any immediate answers by searching smile

Re: Custom tile server overlay?

Hello.

How to overlay:
https://infinity-code.com/atlas/online- … ample.html
This example loads overlay from the Resources folder. Instead, you need to make a request to the server you want.
https://infinity-code.com/doxygen/onlin … ea56c0a5ab

You can save downloaded data yourself and save to Application.persistentDataPath.
https://docs.unity3d.com/ScriptReferenc … aPath.html
Or you can use Online Maps cache (OnlineMapsCache.Add / OnlineMapsCache.Get).

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 40 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.

Re: Custom tile server overlay?

Thank you! And cool, I got it to work!

https://storage.googleapis.com/naked-sailor.appspot.com/public/mapbox_w_seamarks.png

Re: Custom tile server overlay?

Well, one big memory leak problem still.

I've tried copying the examples, but I'm sure there's something obviously wrong with how I do it since there is huge leakage smile I tried updating the tile status to loading - loaded - etc, but I couldn't figure it out.

Post's attachments

Attachment icon OpenSeaMapLayer.cs 1.93 kb, 8 downloads since 2020-09-29 

Re: Custom tile server overlay?

I've tested your script with and without cache and I don't see any memory leak.
Please tell me more about the memory leak.
How did you find this? And maybe something else is required for the leak to start?

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 40 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.

Re: Custom tile server overlay?

Oh, interesting. I will research some more about what's happening and get back to you.

I didn't notice anything when running within Unity-- everything seemed fine. Only when running on an iOS device the app kept crashing and I noticed it was hitting the 1.4GB memory limit quickly just by scrolling the map slightly to the left and back right. And by disabling that script the leak went away.

But I'll get back.

Re: Custom tile server overlay?

I found the fix here: https://answers.unity.com/questions/115 … n-ios.html

After lifting the variable out of the function and doing some disposing/unloading the memory usage seems stable on iOS.

Post's attachments

Attachment icon OpenSeaMapLayer.cs 2.02 kb, 10 downloads since 2020-10-01