[OSM-dev] Bulk tile download tool using Java?

Jon Burgess jburgess777 at googlemail.com
Sat Mar 8 16:35:23 GMT 2008


On Sat, 2008-03-08 at 16:43 +0100, Marcus Wolschon wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> Hello Jon,
> 
> that may have been the SmoothTilePainter of Traveling Salesman.
> If the aspect-ratio of the window leaves space above or below
> the earth it tries to download that bit as well. (Only if no
> local map of the area to render is avaliable.)
> 
> I added some checks for that in SVN.
> It is designed to cached successfull downloads but cannot
> determine why a download fails. So it cannot cache unsuccessfull
> ones.

It should be feasible to cache errors after a couple of attempts
regardless of the cause, even if all you do is replace them internally
with a blank tile. Requesting the same URL which returns an error over
again without limit is a bug in my opinion. 

> I am using "javax.imageio.ImageIO.read(url)". There is no way
> to set a user-agent here unless you do your own implementation
> of http.

I don't think you need to re-implement all of HTTP. 

  java.net.URLConnection client;
	client = new java.net.URL(url).openConnection();
        
  client.setRequestProperty("User-Agent", "my-application/1.00");
  client.connect();
  javax.imageio.ImageIO.read(client.getInputStream());

or something like that. I'm no Java expert.

Jon


> Marcus
> 
> Jon Burgess schrieb:
> | Does anyone recognise which tool might be generating the tile requests
> | below? For the past 30 minutes this has been requesting the same invalid
> | tile co-ordinates over and over.
> |
> | The person writing the tool has not heard that the range of valid tiles
> | for a given zoom(Z) is 0...2^Z-1, i.e.
> |
> | * zoom 2 = 0..3
> | * zoom 3 = 0..7
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFH0rQYf1hPnk3Z0cQRAmUyAJ9HD4C2TLUXMkfnoVFUoqSiealEIgCguMDU
> SUkIXp3E8/BAMFfNSGaItbY=
> =MVEb
> -----END PGP SIGNATURE-----





More information about the dev mailing list