JXMapViewer using Google Maps

View: New views
9 Messages — Rating Filter:   Alert me  

JXMapViewer using Google Maps

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I done the sample described in "Building Maps into Your Swing Application with the JXMapViewer"
http://today.java.net/pub/a/today/2007/10/30/building-maps-into-swing-app-with-jxmapviewer.html , and works well. But I want to use google maps as provider, so i use this example : https://bluemarine.dev.java.net/source/browse/bluemarine/trunk/src/Location/GoogleMapsProvider/src/it/tidalwave/bluemarine/maps/google/GoogleMapsProvider.java?rev=1415&view=markup
But when I run the application I have the fowling error:

ul 17, 2008 2:41:28 PM org.jdesktop.swingx.mapviewer.AbstractTileFactory$TileRunner run
SEVERE: Failed to load a tile at url: http://mt1.google.com/mt?n=404&v=w2.21&x=4491&y=6019&zoom=3, retrying
java.io.FileNotFoundException: http://mt1.google.com/mt?n=404&v=w2.21&x=4491&y=6019&zoom=3
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1168)
        at java.net.URL.openStream(URL.java:1007)
        at org.jdesktop.swingx.mapviewer.AbstractTileFactory$TileRunner.cacheInputStream(AbstractTileFactory.java:348)
        at org.jdesktop.swingx.mapviewer.AbstractTileFactory$TileRunner.run(AbstractTileFactory.java:307)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
        at java.util.concurrent.FutureTask.run(FutureTask.java:123)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:613)
Jul 17, 2008 2:41:28 PM org.jdesktop.swingx.mapviewer.AbstractTileFactory$TileRunner run
SEVERE: Failed to load a tile at url: http://mt1.google.com/mt?n=404&v=w2.21&x=4491&y=6018&zoom=3, retrying
java.io.FileNotFoundException: http://mt1.google.com/mt?n=404&v=w2.21&x=4491&y=6018&zoom=3
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1168)
        at java.net.URL.openStream(URL.java:1007)
        at org.jdesktop.swingx.mapviewer.AbstractTileFactory$TileRunner.cacheInputStream(AbstractTileFactory.java:348)
        at org.jdesktop.swingx.mapviewer.AbstractTileFactory$TileRunner.run(AbstractTileFactory.java:307)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
        at java.util.concurrent.FutureTask.run(FutureTask.java:123)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:613)
Jul 17, 2008 2:41:28 PM org.jdesktop.swingx.mapviewer.AbstractTileFactory$TileRunner run
SEVERE: Failed to load a tile at url: http://mt1.google.com/mt?n=404&v=w2.21&x=4491&y=6021&zoom=3, retrying
java.io.FileNotFoundException: http://mt1.google.com/mt?n=404&v=w2.21&x=4491&y=6021&zoom=3


The url is broken? Or my IP is blocked?

Cheers,

Paulo.
[Message sent by forum member 'jpaulo007' (jpaulo007)]

http://forums.java.net/jive/thread.jspa?messageID=287308

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXMapViewer using Google Maps

by Fabrizio Giudici :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello.

I'm the author of that code. It's actually not legal to use Google  
Maps with JXMapViewer (or anything that is not Google Maps API), in  
facts I've dropped that code from my application (you're still able to  
access it through that URL because it's an old revision in the source  
repository).

Before realizing I had to drop that code, I used it for a few weeks  
and noticed that Google periodically changes something in the URL  
(typically the w parameter, which seems to be a version), so the old  
ones for sure don't work at the moment. Since I've not maintained the  
code, I've got no idea of what could be wrong. Of course it could also  
be that in the meantime Google added some better check to make sure  
that the request comes only from a legit requester (i.e. a browser,  
not a Java application).

I suggest you search some other source of data which is legal with  
your purposes (ok, trivial suggestion, it's your business after all,  
but you understand I had to add this ;-).

On Jul 17, 2008, at 15:59 , jdnc-interest@... wrote:

> Hi,
>
> I done the sample described in "Building Maps into Your Swing  
> Application with the JXMapViewer"
> http://today.java.net/pub/a/today/2007/10/30/building-maps-into-swing-app-with-jxmapviewer.html 
>  , and works well. But I want to use google maps as provider, so i  
> use this example : https://bluemarine.dev.java.net/source/browse/bluemarine/trunk/src/Location/GoogleMapsProvider/src/it/tidalwave/bluemarine/maps/google/GoogleMapsProvider.java?rev=1415&view=markup
> But when I run the application I have the fowling error:
>
> ul 17, 2008 2:41:28 PM  
> org.jdesktop.swingx.mapviewer.AbstractTileFactory$TileRunner run
> SEVERE: Failed to load a tile at url: http://mt1.google.com/mt?n=404&v=w2.21&x=4491&y=6019&zoom=3 
> , retrying
> java.io.FileNotFoundException: http://mt1.google.com/mt?n=404&v=w2.21&x=4491&y=6019&zoom=3
>        at  
> sun
> .net
> .www
> .protocol
> .http.HttpURLConnection.getInputStream(HttpURLConnection.java:1168)
>        at java.net.URL.openStream(URL.java:1007)
>        at org.jdesktop.swingx.mapviewer.AbstractTileFactory
> $TileRunner.cacheInputStream(AbstractTileFactory.java:348)
>        at org.jdesktop.swingx.mapviewer.AbstractTileFactory
> $TileRunner.run(AbstractTileFactory.java:307)
>        at java.util.concurrent.Executors
> $RunnableAdapter.call(Executors.java:417)
>        at java.util.concurrent.FutureTask
> $Sync.innerRun(FutureTask.java:269)
>        at java.util.concurrent.FutureTask.run(FutureTask.java:123)
>        at java.util.concurrent.ThreadPoolExecutor
> $Worker.runTask(ThreadPoolExecutor.java:650)
>        at java.util.concurrent.ThreadPoolExecutor
> $Worker.run(ThreadPoolExecutor.java:675)
>        at java.lang.Thread.run(Thread.java:613)
> Jul 17, 2008 2:41:28 PM  
> org.jdesktop.swingx.mapviewer.AbstractTileFactory$TileRunner run
> SEVERE: Failed to load a tile at url: http://mt1.google.com/mt?n=404&v=w2.21&x=4491&y=6018&zoom=3 
> , retrying
> java.io.FileNotFoundException: http://mt1.google.com/mt?n=404&v=w2.21&x=4491&y=6018&zoom=3
>        at  
> sun
> .net
> .www
> .protocol
> .http.HttpURLConnection.getInputStream(HttpURLConnection.java:1168)
>        at java.net.URL.openStream(URL.java:1007)
>        at org.jdesktop.swingx.mapviewer.AbstractTileFactory
> $TileRunner.cacheInputStream(AbstractTileFactory.java:348)
>        at org.jdesktop.swingx.mapviewer.AbstractTileFactory
> $TileRunner.run(AbstractTileFactory.java:307)
>        at java.util.concurrent.Executors
> $RunnableAdapter.call(Executors.java:417)
>        at java.util.concurrent.FutureTask
> $Sync.innerRun(FutureTask.java:269)
>        at java.util.concurrent.FutureTask.run(FutureTask.java:123)
>        at java.util.concurrent.ThreadPoolExecutor
> $Worker.runTask(ThreadPoolExecutor.java:650)
>        at java.util.concurrent.ThreadPoolExecutor
> $Worker.run(ThreadPoolExecutor.java:675)
>        at java.lang.Thread.run(Thread.java:613)
> Jul 17, 2008 2:41:28 PM  
> org.jdesktop.swingx.mapviewer.AbstractTileFactory$TileRunner run
> SEVERE: Failed to load a tile at url: http://mt1.google.com/mt?n=404&v=w2.21&x=4491&y=6021&zoom=3 
> , retrying
> java.io.FileNotFoundException: http://mt1.google.com/mt?n=404&v=w2.21&x=4491&y=6021&zoom=3
>
>
> The url is broken? Or my IP is blocked?
>
> Cheers,
>
> Paulo.
> [Message sent by forum member 'jpaulo007' (jpaulo007)]
>
> http://forums.java.net/jive/thread.jspa?messageID=287308
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jdnc-unsubscribe@...
> For additional commands, e-mail: jdnc-help@...
>
>

--
Fabrizio Giudici, Ph.D. - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog
Fabrizio.Giudici@... - mobile: +39 348.150.6941



---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXMapViewer using Google Maps

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Try this oh "illegal" one

System.setProperty("http.agent", "Opera/7.10 (UNIX; U) [en]");
[Message sent by forum member 'i30817' (i30817)]

http://forums.java.net/jive/thread.jspa?messageID=287459

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXMapViewer using Google Maps

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello again,

Thanks for your answer! I follow your advice and used the GoogleMap web services provided by netbeans, that returns java script.  But I want to show the map on a java swing application. I try to use a simple java web browser but doesn't work. There are another way to solve this problem?

Thanks,

Paulo.
[Message sent by forum member 'jpaulo007' (jpaulo007)]

http://forums.java.net/jive/thread.jspa?messageID=287643

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXMapViewer using Google Maps

by Fabrizio Giudici :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jul 18, 2008, at 18:55 , jdnc-interest@... wrote:

> Hello again,
>
> Thanks for your answer! I follow your advice and used the GoogleMap  
> web services provided by netbeans, that returns java script.  But I  
> want to show the map on a java swing application. I try to use a  
> simple java web browser but doesn't work. There are another way to  
> solve this problem?

So far I tried to use some embedded HTML browser in Java able to run  
the JS GoogleMap APIs, but nothing worked. Nevertheless, things are  
going to change soon (hopefully in ten days or so) since with the  
first preview of the JavaFX SDK I believe that Sun will release also  
JWebKit, which is a Swing component embedding a native WebKit HTML  
renderer. It should be able to run complex JavaScript, I think (I  
hope? :-)

--
Fabrizio Giudici, Ph.D. - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog
Fabrizio.Giudici@... - mobile: +39 348.150.6941



---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXMapViewer using Google Maps

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I had the same problem.
In fact, it's true, Google seems to modify its url periodically.
The argument 'w' is the version.

Under Firefox, I use the 'Live Http Headers' plugin and I saw that the version is currently 2.75.

So you just have to modify your url in something like :

private TileProviderInfo tileProviderInfo = new TileProviderInfo(
                MIN_ZOOM_LEVEL, MAX_ZOOM_LEVEL, TOP_ZOOM_LEVEL,
                TILE_SIZE, false, true,
                "http://mt2.google.com/mt?n=404&v=w2.[b]75[/b]",
                "x","y","zoom");
[Message sent by forum member 'stephciney' (stephciney)]

http://forums.java.net/jive/thread.jspa?messageID=290057

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXMapViewer using Google Maps

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for your tip, it works now. :-)

One more think, In google maps using the browser we have more level of zoom than using JMapViewer. The max zoom for  JMapViewer is 0, but if we compare to google maps using the browser, in the browser we can have one more level of zoom.

It's also possible to set JMapViewer to show the sattellite view.

Cheers.
[Message sent by forum member 'jpaulo007' (jpaulo007)]

http://forums.java.net/jive/thread.jspa?messageID=290148

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXMapViewer using Google Maps

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for your tip, it works now. :-)

One more think, In google maps using the browser we have more level of zoom than using JMapViewer. The max zoom for  JMapViewer is 0, but if we compare to google maps using the browser, in the browser we can have one more level of zoom.

It's also possible to set JMapViewer to show the sattellite view?

Cheers.
[Message sent by forum member 'jpaulo007' (jpaulo007)]

http://forums.java.net/jive/thread.jspa?messageID=290149

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXMapViewer using Google Maps

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Just in case anybody missed this, I think it's probably a good idea to re-iterate that using JXMapViewer to pull Google tiles is ILLEGAL. It very clearly breaks the terms of use set out by Google. Substantial continued misuse of the tile servers will probably lead Google to change their access control to stop the abuse. Developing an application which uses JXMapViewer to pull Google tiles is a bad idea. Use the free map tiles available from OpenStreetMap instead, or negotiate a deal with Google to license the access (good luck).
[Message sent by forum member 'idawes' (idawes)]

http://forums.java.net/jive/thread.jspa?messageID=290166

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...

LightInTheBox - Buy quality products at wholesale price