Unpredictable data usage Map

My ai2 creation using Map (roads map) shows unpredictable internet data consumption. This is not really an issue using wifi but it really is a problem using 3G or 4G internet.
So I installed a realtime Data Monitor App that shows the current data speed (in wifi as well as 3G/4G) in the status bar.
This learned that in my geographic area some zoom levels consume a constant data stream and other zoom levels consume zero after initial loading of the map tile.
Other geographic areas of the globe show different behavior, so it depends on the shapes or objects the particular map section or tile has to show.
In some of the data-intensive map parts you see some sort of flicker in tiny fragments of the map, as if refreshing of the particular map tile never finishes.
Is there an explanation or fix for this?

Explanation: The map tiles are provided by an OpenStreetMap server. How long it takes to render a map on your device depends on the number of tiles needed to fill the map area, how busy the OSM server is, the fact that 3G and generally 4G is not as fast as most WIFI etc. About OSM

Regarding "other zoom levels consume zero after initial loading of the map tile." Apps that use the Map component cache tiles from map tiles previously used. Consequently, the size of your app grows depending on how much real estate is remembered.

Fix: live with the the reality that apps using the cloud are limited and sometimes throttled by the cell phone provider and the limitations of the OSM service. Instead of the Map component you can use the Google Map API using a WebViewer to display your maps. My experience is Google Maps render faster than the OSM tiles provided by volunteers.

Map component users will ALWAYS experience small issues, especially when the OSM are under heavy usage. Usually, slightly moving a map display with a touch 'fixes' the map. Use WIFI whenever possible and when you are away from your home cell phone area be prepared for lack of service, switching between 3G and 4G etc.

Thanks for the reply Steve, but unfortunately you are missing the point here:
Downloading the map tiles goes very fast, nothing to complain about that.
But in my region (Netherlands) the downloading doesn't stop in maybe 40 or 50% of the cases, seemingly random. In the Iowa region that's only the case in maybe 10 or 15% of the cases.
As described, zoom levels that consume severe data in my region may consume zero in other regions. And vice versa. So the map tile content is has something to do with the issue.

I just opened OSM directly on the same phone and it shows short data consumtion loading the tiles but drops to zero in a second. In the same map regions where the AI2 application continues to consume serious amounts of data.
So there must be something wrong with the way AI2 handles OSM?

Probably. If you want to know more, read the OSM documentation. You are asking why and how OSM determines and uses tiles. You might ask your question on a forum dedicated to OSM.

I can attest to the fact that the map rendering without glitches depends on OSM server usage.

That certainly does not totally follow Wil that something is wrong with AI2. If your app contains a GPS link, the app will change its location and probably instigate a small location change in the map. This will happen as often as you programed the GPS receiver to update. Whenever your location updates, it instigates a request to the OSM server. Your app probably continually updates, a direct OSM request for a single location does not. Disable your GPS and check data usage. It should be reduced dramatically. When your gps changes, the map display must reconfigure the tiles too.

Nope, sorry, No GPS involved and no Web calls involved...
Fully static situation.
In some circumstances it consumes somewhere between 1 and 2 GB per hour.
For the majority of users that would pose a serious problem to their data budget.
I appreciate your input though.
Tomorrow I'll build another app without any additional functionalities and post my findings here.

Same problem with this simple setup in some zoom levels: 1 up to 2GB per hour data.
Note how different zoomlevels show different behavior.

Look at marked positions:
First: data usage per second,
Second: part of map that flickers.

Can you share your AIA project here?

Of course:
datatest.aia (2.1 KB)

I ran it on a Samsung tablet as wel as on my Samsung phone: both show the issue as described.
B.t.w.: I use Data Monitor from KF Software House in Playstore.
It looks to me that for some reason AI2 keeps trying to load the same tile(s) over and over again.
The project I shared here is the stripped version of my real application, created to plot bearing lings from a Radio Direction Finder. But also this stripped version shows the same issue.

There is a problem. But is it a problrm on the Appinventor side or on the side of a map supplier, I do not know it anymore. I recorded a movie to show what the problem is.
At the beginning of the movie you can see that the transfer is 0KB / S, when the map moves, the transfer increases and download new tiles, but it does not lower. Later, move the map again and the transfer drops to 0kb / s. This happens with various regions of the world. Blinking different elements of the map also noticed. This happens to the location enabled and disabled.

Exactly, glad you took the time to reproduce and study the issue, thank you.
The funny thing is that direct access to OSM does not show the issue at all, only the implementation in AI2 does.
So how to proceed from here?
Does this thread ensure that it gets the attention of the people that can solve it?
Or do I need to drop it somewhere else to get the attention of the AI2 engineers?

I think it's enough that @ewpatton will look at it. I see that he is the author of this component.

Super, thanks again you both for your input.

How are you doing that OSM access Wil?

Did you do a similar test of data flow using the OSM web page? Did you use your browser to access OSM? Here is a discussion showing how to access [OpenStreetMap without the Map Component] (https://groups.google.com/g/mitappinventortest/c/gGAeQN3r_fg/m/Dc8PY5HrAwAJ ) using App Inventor . As a comparison Wil, can you test data usage using network using access to OSM like this example? Knowing that might help MIT.

The app using Map caches OSM tiles. It is probably saving them to the app and continues to down load after screen movement as a guess. That does not happen when accessing OSM directly and might be part of the issue.

Not familiar with your data flow tool. It may be monitoring ALL data flow and why you get the response you see. You discuss excessive rates of severel Gb in an hour. It has been a while since I tested data usage. In an hour long test I made some time ago with network on for an hour, the usage was only on the order of Mb's based on my cell Provider records. Not excessive. I can't explain your usage.

Another developer expressed similar behavior with respect to Map tile behavior a year ago. He reported to MIT, see Evan's reply Map component: frequent tile re-load

The Map component uses some of the code in the LocationSensor component. It will poll a location change every 60 seconds so, depending on the Map settings. The issue could be related to that behavior.

Thanks for your example.


Hi Steve,
The "Map component frequent tile re-load" issue seems to be exactly the same issue.
Evan's suggestion: I can't find any tile in the directory he points out. It's empty.
But my app stores tiles without any problem, because when I cut off any internet is has stored exactly the tiles I visited in the zoom level I used.
The issue absolutely is repeatedly loading the same tile for whatever reason.: If I happen to be on a tile with zero data traffic, swiping the map to the next tile sometimes shows a short burst in data but within a second data usage drops to zero again, like it does in OSM in a browser.
But in a lot of occasions, that data stream won't stop, it stays at 400kB per second or so, until I carefully swipe back to the previous tile. So there seem to be tiles that do load (are stored in my phone) but are still being reloaded. Swapping between 2 zoom levels may sometimes show the same behavior. My app needs the Map component for the features it can offer, like drawing lines etc.
Running my stripped datatest.aia Patryk_F saw the same issue.
And installing/running datatest.aia I don't give GPS permission, nore doe I see any activity of that kind.
Other apps consuming that amount of data is out of the question. It is directly related to what I do with the Map in AI2.

Edit: I just built and run the alternative OSM approach you suggested and found this:
1, Data consumption for loading a fresh tile is considerably lower and drops to zero in less than a second.
2, I wasn't able at all to get the same reload issue, not a single time and believe me... I tried! :wink:

I hope that helps.

Hello fellow developers,
I originally reported the Map component: frequent tile re-load issue some time ago.
Thank you for re-reporting this issue as I can confirm that it hasn't been sorted out yet.

I conducted the same test as one year ago, this time on a new phone (Sony Xperia 10 II) and on Android 11. Unfortunately, the map component still shows the same unwanted behavior.
Sniffing my network traffic on Wireshark, I can observe that the tiles in question are reloaded very often, but only some tiles and some zoom levels are affected by this issue, as you already stated.

For this test, I created an app that only contains the Map component and no blocks (see this aia: maptest.aia (1.0 KB) )

Wireshark tells me that all requested tiles are being loaded from the OSM server with no issues, i.e. with HTTP code 200.

Thanks, I just edited my response to Steve.

Do you mean in the Android Settings, you turned Location off? Map has it's own LocationSensor as part of the component (users cannot control it, it just is. You cannot turn on or off that feature). Perhaps Evan will explain.

I ran your aia Will; I see you do not connect a LS. I looked at Patryks video. Your data toy shows activity indicating something. Did you look and test the non Map component OSM access discussion I provided using your data logger? What are the results?

You might continue using the Map with all its foibles, I expect it will be a while before MIT finds the issue. I don't see a serious issue based on my tests but sympatize with you guys. The issue might be with App Inventor, it might be as Patryk suggests an issue with the OSM api accessing their server. Only MIT can figure this out.

In the meanwhile, you might use the Google Maps api along with a WebViewer and do your dataflow check. Google's map tiles used this way may consume less data. Developers can do the same stuff Map can ... zoom, plot locations, plot traks, determine bearings etc. Google Static Map API
Why not try this and see how data flow compares?

Also, continue to post your theories, they may help Evan debug if necessary.

As you can see I added my findings in my last post Steve.
Well, I can't recommend any designer to use the map module now, as it may burn up a modest data budget within a few hours...
And most people may have no idea what's went wrong.

The data consumption of your alternative OSM approach is peanuts. No issue at all.
So, MIT would do a lot of users a big favor if this bug gets fixed.

I'll arrange a time to look at this today. We use another library for drawing the map on the phone compared to the browser, and it's possible that something is going wrong there if just one tile is causing issues.