We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 25ca90c commit a9e5e95Copy full SHA for a9e5e95
src/main/groovy/geoscript/layer/OSM.groovy
@@ -75,8 +75,13 @@ class OSM extends ImageTileLayer {
75
ImageTile tile = new ImageTile(z, x, y)
76
String baseUrl = getBaseUrl()
77
URL url = new URL("${baseUrl}/${z}/${x}/${y}.${imageType}")
78
- url.withInputStream {input ->
79
- tile.data = input.bytes
+ URLConnection urlConnection = url.openConnection()
+ urlConnection.setRequestProperty("User-Agent", "GeoScript Groovy")
80
+ InputStream inputStream = urlConnection.inputStream
81
+ try {
82
+ tile.data = inputStream.bytes
83
+ } finally {
84
+ inputStream.close()
85
}
86
tile
87
0 commit comments