Topic: Google Maps Tile Version automatism?

Hello,

Today I realized that my satellite map in an old app of mine is only showing white tiles.
The app is not updated for 2 years and can't be updated right now.

I realized that you have to set a map tile version in Unity and this version does not update itself.
Why do I have to update it manually?

And for my problem: Does google stop supporting older map tile versions at some point?
Is there an option to automatically update the tile version?

Could it also be a google server issue? I just set the latest tile version in my dev project and it works again. But my version before was only 1 month old. Like 5 version numbers below the latest.

This should not happen in a live app. So I guess I will need to fetch the version number from database in the future to be able to fix this issue without having to update a whole app?

Any help is appreciated.
Cheers, Robert

Re: Google Maps Tile Version automatism?

Hello.

Tiles all over the Earth are tens and hundreds of terabytes in size on servers.
Google has a zoom of up to 23 in some places on Earth (other providers have a maximum zoom of 18-20), and it is possible that its servers store petabytes of data for only one version of the tiles.
So the number of versions of tiles on the servers is limited, and when new ones are added, very old ones are deleted.

Why auto-checking the versions of the tiles is not present out of the box:
Actually, I just hadn't thought in that direction, and you are the first person to write to me about this problem.
In future versions, I will try to make automatic version checking of tile versions.

What you can do right now:
Look at OnlineMapsEditor.cs (lines 743-760).
You can make your own script which will check the versions of the tiles when the application starts, save the version number in PlayerPrefs, and use it when generating the url of the tiles.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Google Maps Tile Version automatism?

Of course I get that it is a lot of data. Our app always worked fine until this Saturday when users started complaining about white map tiles when they switch to satellite map.

I checked my latest version of the app in Unity and tested with tiles version 941 and had the same issue. with latest version (946) it worked. I had the fear that something is wrong with my maps API key but can't see any issues in my google account.
Maybe google only supports latest map version from now on? I didn't get any heads up email from google though.

Would you be able to test this on your side? Even when I enter Tile Version 945 it does not work anymore. Only 946 works.

Re: Google Maps Tile Version automatism?

On my side, only 946 works too.
945 works for a very limited number of areas.
This is the first time I have seen this situation.

Maybe it's some problem with their servers.
I will have to check again in a while.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Google Maps Tile Version automatism?

Thank you for testing. So I guess I can rule out an issue in my google API settings.
If they stopped supporting different tile versions than the latest one, they would have send email months ago I guess.

Fingers crossed that this is only a temporary issue hmm

Re: Google Maps Tile Version automatism?

I mean, even IF they stopped supporting any older tile version, they could just forward any request to the latest tile version instead of breaking lots of apps, right?

Re: Google Maps Tile Version automatism?

I just asked the google maps support if something broke on their end and gave them a sample link like

tile with version 946
https://khms0.googleapis.com/kh?v=946&a … 6&z=18

same tile with version 945
https://khms0.googleapis.com/kh?v=945&a … 6&z=18

to show him that only version 946 is working.

They replied, that this link is not intended to be accessed by customers directly and used in that way.
It was just an example. I got that link through my browsers console with a google map.

Can you tell me how the Online Maps plugin accesses the tiles with the correct link so I can tell the support guy how the tiles are fetched? They only sent me links to google maps api documentation.

Re: Google Maps Tile Version automatism?

Quote from Online Maps documentation (section Licenses and API keys):

Presets for all providers and map types are provided for testing purposes.
The legal way is to use Google Maps tiles in your applications:
https://developers.google.com/maps/documentation/tile/

It's also written in the inspector if you hover over the question button, next to the provider field.

If you want to use Google Maps legally, I recommend that you consider using this service, or switch to another provider.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Google Maps Tile Version automatism?

Hi,

okay so I need to change the provider or do something on my own here?
Just asking because it worked for years but now the satellite map only works with latest tile version and I am searching for a solution which does not involve changing anything because I currently don't have the ressources to update my apps sad

So did google change their mao tile version system?
Maybe it's an issue on googles side but I don't know how to explain it to them.

I don't mind paying and going the legal way. How can I setup Online Maps going the legal way in Unity? Do I need another plugin then?

Re: Google Maps Tile Version automatism?

What are my Options?

- I can wait and hope if Google fixes the issue (if it is an issue at all, maybe they stopped supporting map tile versions)
- I can add some code to always find the latest tile version on app start but as you said, it still would not be the legal way I guess.
- I can use another Provider within the OnlineMaps plugin like ArcGIS Satellite and stick with Google for Street Maps only
- I can use the legal way of using Google Satellite Maps (but I don't know how to do that with OnlineMaps plugin)
- I can search for a different unity plugin but that means I have to redo the whole logic of my map as it is completely based on the OnlineMaps asset

I would like to stick with google satellite maps as users are placing markers in an online web application using a google map, so it would be good they have the same map also in the game to avoid that markers are not at the exact same location.
Do you have some documentation on how to setup OnlineMaps so it uses my API Key for fetching the satellite tiles the legal way?

I'm sorry for being annoying but I'm currently pretty stuck and need to find a solution so my users can continue using the satellite maps, ideally without having to update my apps.

Re: Google Maps Tile Version automatism?

About your options:
1. As of now, it's been a few days since the old versions of the tiles stopped working, so I think they're stopped completely.
2. Yes, it is.
3. It's your choice. But please note that the tiles are not owned by Google. They come from third party sources, the names of which you can read at the bottom of Google Maps. For the high zoom level tiles these are usually Maxar, DigitalGlobe or CNES Airbus.
You can use the tiles from these sources directly without using Google as an intermediary.
4. Here's an example:
https://forum.infinity-code.com/viewtop … 8723#p8723
5. It's your choice.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

12 (edited by wuselrob 2023-05-24 11:24:11)

Re: Google Maps Tile Version automatism?

1. that is really bad sad

about your sample in 4:
I tried it but I get a 403 forbidden when it should create a sessionkey. I activated Map Tiles API and created an access key for it. I also tried changing the urls from "https://www.googleapis.com..." to "https://tile.googleapis.com" as it says in their documentation but creating the session key seems to fail with "The caller does not have permission".
There are no limitations set for the access key.

HTTP/1.1 403 Forbidden
{
  "error": {
    "code": 403,
    "message": "The caller does not have permission",
    "errors": [
      {
        "message": "The caller does not have permission",
        "domain": "global",
        "reason": "forbidden"
      }
    ],
    "status": "PERMISSION_DENIED"
  }
}

Re: Google Maps Tile Version automatism?

The same thing.
I searched for over an hour on the Internet for this problem, and I couldn't find anything similar.
Try asking Google support why the session creation does not work.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Google Maps Tile Version automatism?

I asked google support and they told me that the Google Map Tiles API is only available for selected customers and you have to  apply for it. This is the reason for the 403 response.

What a mess sad But they didn't answer my questions regarding the satellite tile versioning or if they stopped support or something.
So what is the legal way of fetching satellite maps when only selected customers can use the Tiles API?
I could leave it the way it is and always fetch the latest tile version on app start then. But who knows if they stop support of this as well in a few weeks.

Re: Google Maps Tile Version automatism?

Ask to be added to the list of selected users, or not to use Google Tiles.
You can write that you want to use the Tiles API in Cesium for Unity (I don't know what that is, I just found it in their documentation), and it's very likely they'll give you access.

I think this is part of some big change in Google Maps that is happening right now.
What I mean:
Half a year ago, the Google Tiles API documentation page had a big red notation that only whitelisted users could use the service.
You could not enable the Tiles API in the Google Developer Console, it just wasn't there.
The documentation was minimal and only in English.
There was no documentation about 3D Tiles and Street View Tiles.
That's changed a lot now.
It's quite possible that they are getting ready to make it public.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

16 (edited by wuselrob 2023-05-30 20:41:21)

Re: Google Maps Tile Version automatism?

I'm currently looking into my old apps code and want to add a check for the latest tile version.
In these apps we still use the Online Maps version 3.6.3.1.

So I found the "Detect the latest version of tiles" code in OnlineMapsEditor.cs at line #695 and I added the WebClient and Regex part into my app start which fetches the latest tile version and save it into PlayerPrefs.
What I am struggeling with is, how can I set this version now at runtime?
Is there a property I can set the version to? In the EditorScript it adds an ExtraField with the tile version but how do I set it at runtime?

Edit: ok I think I got it to work.

private void SetGoogleMapsTileVersion()
        {
            OnlineMapsProvider.MapType mapType = OnlineMapsProvider.FindMapType("google.satellite");
            OnlineMapsProvider.ExtraField version = mapType.extraFields.FirstOrDefault(f =>
            {
                OnlineMapsProvider.ExtraField ef = f as OnlineMapsProvider.ExtraField;
                if (ef == null) return false;
                if (ef.token != "version") return false;
                return true;
            }) as OnlineMapsProvider.ExtraField;
            if (version != null)
            {
                int n;
                if (PlayerPrefs.HasKey("tileVersion"))
                {
                    version.value = PlayerPrefs.GetString("tileVersion");
                }
                else
                {
                    version.value = CTLocalizationManager.Instance.GetLocalizedValue("tileVersion");
                }

                if(!int.TryParse(version.value, out n))
                {
                    version.value = "947";
                }
                Debug.Log("SETTING TILE VERSION TO " + version.value);
            }
        }