tillnagel / unfolding

A library to create interactive maps and geovisualizations in Processing and Java
http://unfoldingmaps.org
Other
477 stars 245 forks source link

403 Error code for requesting google maps provider with unfoldingmaps #145

Closed jsolorzano88 closed 7 years ago

jsolorzano88 commented 7 years ago

Hi there, I'm encountering an issue that has been reported before and after looking through different forums, I am not able to find the root cause and the proper solution. Using the unfoldingmaps library for the Coursera course OOP in java, the google map provider starts giving the following error:

Unfolding Map v0.9.7 (UCSD edition) Using OpenGLMapDisplay with processing.opengl.PGraphics2D java.io.IOException: Server returned HTTP response code: 403 for URL: http://mt1.google.com/vt/lyrs=m@116&hl=de&x=180&y=414&z=10&s=Galileo at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876) at sun.net.www.protocol.http.HttpURLConnection.access$200(HttpURLConnection.java:91) at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1466) at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1464) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:782) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1463) at java.net.URL.openStream(URL.java:1045) at processing.core.PApplet.createInputRaw(PApplet.java:7267) at processing.core.PApplet.createInput(PApplet.java:7235) at processing.core.PApplet.loadBytes(PApplet.java:7462) at processing.core.PApplet.loadImage(PApplet.java:5879) at de.fhpotsdam.unfolding.tiles.TileLoader.getTileFromUrl(Unknown Source) at de.fhpotsdam.unfolding.tiles.TileLoader.run(Unknown Source) at java.lang.Thread.run(Thread.java:745) The file "http://mt1.google.com/vt/lyrs=m@116&hl=de&x=180&y=414&z=10&s=Galileo" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.

I know the current solution is to use anothe rprovider, but I dont believe this enough information. I encountered a major problem today. I ran the file(eclipse) from my jobs network and it completely blocked our IP. I work for a fleet management service provider, so using the google maps api is major part of our operation, which we were not able to do due to this issue. I know your work is for educational purposes, but I was looking for a proper solution(if possible) or atleast to understand more as to why this is happening. Appreciate the time.

tillnagel commented 7 years ago

You might have requested too many tiles from Google Maps, so they blocked your IP(s). If you deem this not true you need to contact Google. (Even accessing a single tile from outside of Google Maps API might be already against their TOC.)

Please check our respective note: http://unfoldingmaps.org/tutorials/mapprovider-and-tiles#various-map-providers

sh4dow007 commented 6 years ago

use any VPN service, your IP is making too many request most probably because you have used it alot while making your project, google thought it as an system generated repeated requests. you can avoid it for a while by using VPN. ENJOY..!!

vcapra1 commented 5 years ago

Why would Unfolding even offer the option to use Google maps tiles when making such requests isn't allowed? Wouldn't simply removing it, or changing the provider to access the API the right way, be a better option?

tillnagel commented 5 years ago

@vcapra1 As we state in our note, "we are providing the example providers for educational purposes".

rzh1999 commented 4 years ago

As we state in our note, "we are providing the example providers for educational purposes". What kind of answer is this? This problem exists if you are taking the courses for educational purposes

KKDJOSEPH commented 4 years ago

How to use VPN services? Just open it and Eclipse will know how to work with it? Do I need to set up something in Eclipse?

sudarshan1985 commented 4 years ago

If this just a coursera project you are doing, then why not just use the static map which unfolding api provides you, just use this:

map = new UnfoldingMap(this,200,50,700,500);

Don't use the Google.GoogleMapProvider() or Microsoft.AerialProvider() , they will block your IP in two or three attempts.

tillnagel commented 4 years ago

Just as a heads-up: The default map provider (Unfolding uses when it is initialized as in @sudarshan1985's example) is using tiles from an external server (namely: the Positron map with labels from Carto).

Jplaudir8 commented 4 years ago

Hi @tillnagel !, I have a question regarding this library, from what I just read in this comments thread, my IP may have also gotten blocked. I do not use any VPN service anymore so what would be the solution to get my IP unblocked? I may start working under an offline mode then. This is discouraging since I just started a course that uses this library lol

tillnagel commented 4 years ago

Which map provider were you using? You need to switch to another freely available one (e.g. Mapbox with your own API-ID).

Jplaudir8 commented 4 years ago

I was using Google.GoogleTerrainProvider();

Oh ok! I will see if changing it to another works whenever I get the issue again because I just ran my program and it is working again, maybe I have a limited number of requests per day? Now its up and running normally haha

tillnagel commented 4 years ago

Yes, Google is limiting the number of requests per interval.

NB: Keep in mind you must not use Google map tiles in your project outside of Google Map API anyway. We are providing this for testing purposes only.

Sumit-Budhiraja commented 3 years ago

This is happening because you are using Google Maps API and they are restricting your IP in two three attempts.

JonathanSum commented 2 years ago

I am currently taking the Coursera Java UCSD course. It looks like I can only get 403 response. Does it mean I can't access it for educational purpose?

Mohamed-coder-beep commented 1 year ago

The file "http://mt1.googleapis.com/vt?&x=180&y=410&z=10&apistyle=s.t%3A3|p.v%3Asimplified%2Cs.t%3A2|p.v%3Aoff%2Cs.t%3A81|p.v%3Aoff" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable

guys i am having this issue with google maps . how should I solve it