diff --git a/src/main/java/com/example/cosmos_serversb/models/Shops.java b/src/main/java/com/example/cosmos_serversb/models/Shops.java index 0a38008..5de0b6e 100644 --- a/src/main/java/com/example/cosmos_serversb/models/Shops.java +++ b/src/main/java/com/example/cosmos_serversb/models/Shops.java @@ -37,13 +37,9 @@ public static ArrayList getShop(String leftLatitude, String leftLongitude, String rightLatitude, String rightLongitude) { String result = ""; - String genre; - String code; - String location; int count = 100; - String[] split; try { - URL url = new URL("https://map.yahooapis.jp/search/local/V1/localSearch?bbox=" + leftLatitude + "," + leftLongitude + "," + rightLatitude + "," + rightLongitude + "&gc=02&results=100&output=json&appid=dj00aiZpPTVzYzloUDJjS0VMSyZzPWNvbnN1bWVyc2VjcmV0Jng9MGE-"); + URL url = new URL("https://map.yahooapis.jp/search/local/V1/localSearch?bbox=" + leftLongitude + "," + leftLatitude + "," + rightLongitude + "," + rightLatitude + "&gc=02&results=100&output=json&appid=dj00aiZpPTVzYzloUDJjS0VMSyZzPWNvbnN1bWVyc2VjcmV0Jng9MGE-"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.connect(); String tmp = ""; @@ -71,10 +67,10 @@ count = Integer.parseInt(total); } for (int i = 0; i < count; i++) { - genre = jnode.get("Feature").get(i).get("Property").get("Genre").get(0).get("Name").asText(); - code = jnode.get("Feature").get(i).get("Property").get("Genre").get(0).get("Code").asText(); - location = jnode.get("Feature").get(i).get("Geometry").get("Coordinates").asText(); - split = location.split(","); + String genre = jnode.get("Feature").get(i).get("Property").get("Genre").get(0).get("Name").asText(); + String code = jnode.get("Feature").get(i).get("Property").get("Genre").get(0).get("Code").asText(); + String location = jnode.get("Feature").get(i).get("Geometry").get("Coordinates").asText(); + String[] split = location.split(","); Shop shop = new Shop(genre, Integer.parseInt(code), Double.parseDouble(split[0]), Double.parseDouble(split[1])); shops.add(shop); }