Skip to content

Commit

Permalink
fix 500s on tile request
Browse files Browse the repository at this point in the history
Signed-off-by: qGYdXbY2 <[email protected]>
  • Loading branch information
qGYdXbY2 committed Nov 28, 2024
1 parent 32327b2 commit bca234a
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,12 @@ else if( acceptTypeSuffix != null )
try {
WebMercatorTile tileAddress = null;
HQuad hereTileAddress = null;
if ("tms".equals(tileType)) {
tileAddress = WebMercatorTile.forTMS(tileId);
} else if ("web".equals(tileType)) {
tileAddress = WebMercatorTile.forWeb(tileId);
} else if ("quadkey".equals(tileType)) {
tileAddress = WebMercatorTile.forQuadkey(tileId);
} else if ("here".equals(tileType)) {

switch( tileType ) {
case "tms" : tileAddress = WebMercatorTile.forTMS(tileId); break;
case "web" : tileAddress = WebMercatorTile.forWeb(tileId); break;
case "quadkey" : tileAddress = WebMercatorTile.forQuadkey(tileId); break;
case "here" :
if (tileId.contains("_")) {
String[] levelRowColumnArray = tileId.split("_");
if (levelRowColumnArray.length == 3) {
Expand All @@ -358,6 +357,10 @@ else if( acceptTypeSuffix != null )
} else {
hereTileAddress = new HQuad(tileId, Service.configuration.USE_BASE_4_H_TILES);
}
break;

default:
throw new HttpException(BAD_REQUEST, String.format("Invalid path argument {type} of tile request '%s' != [tms,web,quadkey,here]",tileType));
}

if (tileAddress != null) {
Expand All @@ -373,7 +376,10 @@ else if( acceptTypeSuffix != null )
event.setX(hereTileAddress.x);
event.setY(hereTileAddress.y);
event.setQuadkey(hereTileAddress.quadkey);
}
}
else
throw new IllegalArgumentException();

} catch (IllegalArgumentException e) {
throw new HttpException(BAD_REQUEST, "Invalid argument tileId.");
}
Expand Down

0 comments on commit bca234a

Please sign in to comment.