glob3mobile / g3m

The multiplatform advanced visualization framework
http://www.glob3mobile.com/
Other
116 stars 56 forks source link

Access denied to WMS/TMS servers? #148

Closed fegyi001 closed 8 years ago

fegyi001 commented 8 years ago

Hello Everyone, especially @glob3mobile @DiegoGomezDeck!

I just discovered g3m and since it seems like an advanced 3d tool I decided to dive into it. I must admit I have problems even with the HelloWorld GWT example.

After following the tutorial at https://github.com/glob3mobile/g3m/wiki/Hello-World-HTML-(GWT) I wanted to launch the app in my browser, but unfortunately I received an error which is caused by the Proxy I guess. This is an example call:

http://127.0.0.1:8888/proxy?url=http://otile3.mqcdn.com/tiles/1.0.0/map/2/1/3.jpg

The response is the following:

Access Denied - You don't have permission to access >"http://otile3.mqcdn.com/tiles/1.0.0/map/2/1/3.jpg" on this server. Reference #18.e40de1c1.1447164558.852f82a

If I simply insert the jpg url into the browser I receive the image with no problem. That's why my guess is that the Proxy must be malfunctioning.

I tried with a different layer, added OpenStreetMap instead of the default MapQuest layer. The images still don't come when I call for example

http://127.0.0.1:8888/proxy?url=http://c.tile.openstreetmap.org/2/1/2.png

This time an OpenStreetMap specific error is received:

ERROR The requested URL could not be retrieved The following error was encountered while trying to retrieve the URL: http://tile.openstreetmap.org/2/1/2.png Access Denied. Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect. Your cache administrator is webmaster@openstreetmap.org.

Here is a screenshot of my Chrome, maybe this explains the problem more. http://s22.postimg.org/8f5ixfu6p/Untitled.png

Anyone could help me with this problem?

DiegoGomezDeck commented 8 years ago

Hello @fegyi001

I'm quiet sure the servers you tried supports CORS requests. In this case, you don't really need a proxy.

To avoid using a proxy, you can do the following after the instantiation of G3MBuilder_WebGL:

  final G3MBuilder_WebGL builder = new G3MBuilder_WebGL();

  final String proxy = null;
  builder.setDownloader(new Downloader_WebGL( //
           8, // maxConcurrentOperationCount
           10, // delayMillis
           proxy));

It means: don't create a default (with proxy) downloader but use the given one (with proxy=null).

With this, it should work.

Cheers,

-- Diego

fegyi001 commented 8 years ago

Hello @DiegoGomezDeck

Thanks for the quick reply, this small code snipped just solved the problem. Wow. I recommend modifying the code samples in the repo (G3MWebGLDemo, HelloWorld etc), since I'm pretty sure all newbies will face the same problem.

Best, Fegyi