Topic: Tile Counter

https://thumb.ibb.co/f5a4HS/img1.png
http://tools.infinity-code.com/TileCounter/

Free online utility for calculating the number and size of tiles in the specified area.
Useful if you plan to make an offline application.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 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: Tile Counter

Great tool.
Any chance to get source code of this ?
In fact, I would like to fill the tiles cache for a particular range and zoom levels and I think that it may help.  Regarding the way on how to iterate threw all tiles in the range and download them, do you have any suggestion ? (I know that there is a python tool but I need to do it in realtime inside the app).
Thank you in advance for your help

Re: Tile Counter

This is JavaScript and you can always look at the source code.
http://tools.infinity-code.com/TileCoun … counter.js

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 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: Tile Counter

Of course, I did not check the page source code, thank you very much for the direct link! I just found that "CoordinatesToTile" already exists in C# with "OnlineMaps.instance.GetTilePosition" and correct me if I am wrong but the coord of each tiles are integer of those values.
Regarding download part and according to you, what would be the best way to "force" a download of a particular tile ? Do I have to create a "OnlineMapsRasterTile" and then call "OnlineMapsTileManager.StartDownloadTile(tile)" ? I tried to take a look at "CacheTilesExample". First of all, I can simply call GetTile if something is returned so tile is already cached, am I right ?
Thank you for your great support

Re: Tile Counter

I think you are looking for this:
https://forum.infinity-code.com/viewtop … 4612#p4612

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 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: Tile Counter

Perfect! Just one more thing because this script will export stuff in the specified "tiles" folder. But can it be used to prefill the cache instead ? I mean "OnlineMapsCache.instance" ?
Thank you very much for all your feedbacks and great work from here!

Re: Tile Counter

This script will download tiles to Application.persistentDataPath, and load tiles from this folder.
The downloaded data will not be cached.

Why would you want to use a cache for this?

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 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: Tile Counter

The principle of the cache is fine because often it will only download what we are viewing. But sometimes we have to go offline and just before we would ensure that all tiles we'll need would be accessible. Perhaps we could switch between the cache (transparent most of the time) and the "fully exported tiles folder" when we need it ? In this use case, I suppose that we have to create and use our own provider reading files from our folder ?
I hope it is clear enough
Thank you again

Re: Tile Counter

You don't need to switch between cache and this script.
They will work well together and complement each other.

In theory, you can modify this script and use OnlineMapsCache.AddItem and OnlineMapsCache.Get to store the data in a custom cache.
https://infinity-code.com/doxygen/onlin … c0cbb1e451
But I wouldn't do that.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 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.