This is a static archive of our old OSM Help Site. Please post any new questions and answers at community.openstreetmap.org.

accessing openstreetmap via servlet

0

Hi All,

I am using OSM for my application which is hosted on tomcat. Application is accessible only via https as a result of it http calls made to get tile on open e.g. :- http://tile.openstreetmap.org/3/2/1.png would fail. Since security violation ...

I thought of creating a proxy via a servlet i have shown code below used in doGet ...this wont work

URL url = new URL("http://tile.openstreetmap.org/3/2/1.png"); BufferedImage bimg = ImageIO.read(url); response.setContentType("image/png"); OutputStream outputStream = response.getOutputStream(); ImageIO.write(bimg, "png", outputStream); outputStream.close();

error i get is - Caused by: java.net.SocketException: Software caused connection abort: recv failed

Can anyone tell me what could be an issue? I have used the same code above pointing to different site to get an image and it works just fine....

asked 11 Nov '11, 16:35

Mayank's gravatar image

Mayank
1111
accept rate: 0%

What useragent would osm see your servlet proxy using? I don't know whether it is going to be the problem, but I think some are blocked. It might help someone who knows more about the technical aspects to answer, though.

(11 Nov '11, 16:43) EdLoach ♦

actually i am not passing useragent ... let me try that and will keep u posted

(11 Nov '11, 16:48) Mayank

i happen to come across this link http://wiki.openstreetmap.org/wiki/Tile_usage_policy

i tried using Alternative tile server from http://tile.openstreetmap.org/3/2/1.png to http://a.tile.openstreetmap.org/3/2/1.png and the code works... i am not sure what is going on....

why are the same restrictions not applied to http://a.tile..... as that of http://tile...

Any advice?

(11 Nov '11, 17:03) Mayank