Skip to content

Commit 90f95ff

Browse files
committed
Fixed GMTEDProvider
1 parent eac4872 commit 90f95ff

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

core/src/main/java/com/graphhopper/reader/dem/GMTEDProvider.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
import java.io.FileInputStream;
2929
import java.io.IOException;
3030
import java.io.InputStream;
31+
import java.util.Locale;
32+
33+
import static com.graphhopper.util.Helper.*;
3134

3235
/**
3336
* Elevation data from Global Multi-resolution Terrain Elevation Data 2010 (GMTED2010).
@@ -198,7 +201,7 @@ public double getEle(double lat, double lon) {
198201
throw new RuntimeException("Can't decode " + file.getName(), e);
199202
} finally {
200203
if (ss != null)
201-
Helper.close(ss);
204+
close(ss);
202205
}
203206

204207
fillDataAccessWithElevationData(raster, heights, WIDTH);
@@ -226,17 +229,17 @@ String getFileName(double lat, double lon) {
226229
int latInt = getMinLatForTile(lat);
227230
String north = getNorthString(latInt);
228231
String east = getEastString(lonInt);
229-
String lonString = String.format("%03d", Math.abs(lonInt));
230-
return (String.format("%02d", Math.abs(latInt)) + north + lonString + east + FILE_NAME_END).toLowerCase();
232+
String lonString = String.format(Locale.ROOT, "%03d", Math.abs(lonInt));
233+
return toLowerCase(String.format(Locale.ROOT, "%02d", Math.abs(latInt)) + north + lonString + east + FILE_NAME_END);
231234
}
232235

233236
String getDownloadURL(double lat, double lon) {
234237
int lonInt = getMinLonForTile(lon);
235238
int latInt = getMinLatForTile(lat);
236239
String north = getNorthString(latInt);
237240
String east = getEastString(lonInt);
238-
String lonString = String.format("%03d", Math.abs(lonInt));
239-
return east + lonString + "/" + String.format("%02d", Math.abs(latInt)) + north + lonString + east + FILE_NAME_END + ".tif";
241+
String lonString = String.format(Locale.ROOT, "%03d", Math.abs(lonInt));
242+
return east + lonString + "/" + String.format(Locale.ROOT, "%02d", Math.abs(latInt)) + north + lonString + east + FILE_NAME_END + ".tif";
240243
}
241244

242245
private String getNorthString(int lat) {

0 commit comments

Comments
 (0)