Problem using the WEB library

HARRY

Active Member
Licensed User
Longtime User
I have written a program that calls for Google Static Maps. The URL is
as follows:
URLStr="http://maps.googleapis.com/maps/api/staticmap?center="& TBLatitude.Text & "," & TBLongitude.Text & "&zoom="&
Zoomlevel & "&size=240x240&maptype=roadmap"
URLStr=URLStr & "&markers=size:mid%7Ccolor:green%7C" & TBLatitude.Text & "," & TBLongitude.Text
URLStr=URLStr & "&markers=size:mid%7Ccolor:yellow%7C" & CurLatitude & "," & CurLongitude
If cPPC=True Then
URLStr=URLStr & "&sensor=true"
Else
URLStr=URLStr & "&sensor=false"
End If
WEB1.Navigate(URLStr)

This is the last statement in the sub; no processing is done until the DocumentCompleted event.

Using wireless internet (WIFI) the program works fine, however when I use mobile internet, I get the following error message, displayed in

the WEB window:

GW fout 403
Operatie administratief verboden

Translated from dutch to english:

GW error 403
Operation forbidden for administrative reasons

Removing the line which adds a marker for the current position - these could be zero or null - makes no difference, also setting the sensor

to false in case of cPPC =True, as I use the GPS also in this program, does not effect the bad result.

Loading Google maps with my mobile device using Google Maps and mobile internet works fine as well.

I am testing this program in France, where I will stay another 5 weeks. I do not know whether this message comes from my dutch mobile

operator or from Google, the latter also gives messages in dutch.

Does somebody have any idea why this error message is given?

Harry
 

kustg

Member
Licensed User
i think the url isn't correct.
your Url is :"http://maps.googleapis.com/maps...."
but it must be "http://maps.google.com/maps...."
try it without sensor=.., its optional and i never use it, because i got some errors too. it works without it.
 

warwound

Expert
Licensed User
Longtime User
If the problem isn't with the URL then it may be that the IP address you are requesting the static map image from has reached it's quota and no more requests from that IP will succeed until a certain amount of time has passed...

Google Static Maps API - Google Code

See how 'you' are limited to 1000 requests per day?

Mobile data providers have two options when it comes to assigning IP addresses to users.

They can give you a unique 'real-world' IP address or they can implement what's known as network address translation (NAT) and give a single private IP address to many (maybe hundreds or more) users at the same time.

If your mobile data provider gives you a private IP address which uses NAT to connect to the internet via your provider then it's more than possible that all the users that currently share the same private IP address as you have together exceeded the quota for static maps.

If you could establish whether or not you get a real-world IP address or a NAT private address from your mobile data provider you'd be a step nearer to determining if this is the problem.

I'm not sure how you'd do that - an idea - if you load B4A Bridge on your device while NOT connected to a WiFi network then B4A Bridge will give you the IP address assigned to you by your mobile data provider.

Unfortunately if the problem is as i've described - all users sharing the same IP address are exceeding the maps quota then there's very little you can do about it.
Your mobile data provider might have an option (probably not free) to change to a real-world IP address that is not shared, other than that i think you'd be out of luck.

Martin.
 

HARRY

Active Member
Licensed User
Longtime User
The situation has changed a little bit. If I try to load a map via mobile internet, it succeeds say 1 out of 5 attempts. So, in principle it works, although not reliable.

Hallo kustg,
Thanks for your reply. Unfortunately, changing the URL string as you suggested does not improve the situation. Note that the old string works well when using normal internet (WiFi).

Hallo Martin,
Your reply was very informative, thanks. Every time I make a data connection I get a different internet address. Is this an indication that the address I get is not shared with many other users?

Also, if the limit is the problem, then it is strange that the request for a map sometimes succeeds after a few seconds when trying again. You would expect that waiting for a new day was necessary. Moreover passing the limit should result in a kind of icon in the map area, according to the API documentation.

I noticed also that the strength of the signal does not make difference. Sometimes the request is honoured with a weak signal and refused with a strong signal.

Anyhow, it is strange that something which is forbidden now, it allowed some seconds later.

I will further investigate the problem with the Google Maps discussion groups.

Harry
 

warwound

Expert
Licensed User
Longtime User
Is this an indication that the address I get is not shared with many other users?

Take a look at this page: What is a Private IP Address?.

That page lists the ranges of possible private IP addresses so as long as you can get your device IP address when connected to mobile data you should be able to work out if it's a public or private IP address.

Given the fact that requests for static maps images fail or succeed with no real pattern i suspect the request quote is not being exceeded.
The Google Group is probably the best place to debug the problem further.

Martin.
 
Top