@Test public void testGenerateOverpassUri() { double latitude = 53; double longitude = -7; float accuracy = 50; String expected_uri = "https: String uri = queryOverpass.getOverpassUri(latitude, longitude, accuracy); assertEquals(expected_uri, uri); }
@Override public String getOverpassUri(double latitude, double longitude, float accuracy) { float measuredAccuracy; if (accuracy < 20) { measuredAccuracy = 20; } else if (accuracy > 100) { measuredAccuracy = 100; } else { measuredAccuracy = accuracy; } String overpassLocation = String.format("around:%s,%s,%s", measuredAccuracy, latitude, longitude); String nwr = "%1$s[~\"^(%2$s)$\"~\".\"](%3$s);"; String types = "shop|amenity|leisure|tourism"; String node = String.format(nwr, "node", types, overpassLocation); String way = String.format(nwr, "way", types, overpassLocation); String relation = String.format(nwr, "relation", types, overpassLocation); return String.format("https: }
QueryOverpass implements SourceContract.Overpass { @Override public String getOverpassUri(double latitude, double longitude, float accuracy) { float measuredAccuracy; if (accuracy < 20) { measuredAccuracy = 20; } else if (accuracy > 100) { measuredAccuracy = 100; } else { measuredAccuracy = accuracy; } String overpassLocation = String.format("around:%s,%s,%s", measuredAccuracy, latitude, longitude); String nwr = "%1$s[~\"^(%2$s)$\"~\".\"](%3$s);"; String types = "shop|amenity|leisure|tourism"; String node = String.format(nwr, "node", types, overpassLocation); String way = String.format(nwr, "way", types, overpassLocation); String relation = String.format(nwr, "relation", types, overpassLocation); return String.format("https: } }
QueryOverpass implements SourceContract.Overpass { @Override public String getOverpassUri(double latitude, double longitude, float accuracy) { float measuredAccuracy; if (accuracy < 20) { measuredAccuracy = 20; } else if (accuracy > 100) { measuredAccuracy = 100; } else { measuredAccuracy = accuracy; } String overpassLocation = String.format("around:%s,%s,%s", measuredAccuracy, latitude, longitude); String nwr = "%1$s[~\"^(%2$s)$\"~\".\"](%3$s);"; String types = "shop|amenity|leisure|tourism"; String node = String.format(nwr, "node", types, overpassLocation); String way = String.format(nwr, "way", types, overpassLocation); String relation = String.format(nwr, "relation", types, overpassLocation); return String.format("https: } QueryOverpass(Context context);   QueryOverpass(); }
QueryOverpass implements SourceContract.Overpass { @Override public String getOverpassUri(double latitude, double longitude, float accuracy) { float measuredAccuracy; if (accuracy < 20) { measuredAccuracy = 20; } else if (accuracy > 100) { measuredAccuracy = 100; } else { measuredAccuracy = accuracy; } String overpassLocation = String.format("around:%s,%s,%s", measuredAccuracy, latitude, longitude); String nwr = "%1$s[~\"^(%2$s)$\"~\".\"](%3$s);"; String types = "shop|amenity|leisure|tourism"; String node = String.format(nwr, "node", types, overpassLocation); String way = String.format(nwr, "way", types, overpassLocation); String relation = String.format(nwr, "relation", types, overpassLocation); return String.format("https: } QueryOverpass(Context context);   QueryOverpass(); @Override String getOverpassUri(double latitude, double longitude, float accuracy); @Override String queryOverpassApi(String urlString); @Override void processResult(String result); @Override void queryOverpass(double latitude, double longitude, float accuracy); String getType(JSONObject tags); }
QueryOverpass implements SourceContract.Overpass { @Override public String getOverpassUri(double latitude, double longitude, float accuracy) { float measuredAccuracy; if (accuracy < 20) { measuredAccuracy = 20; } else if (accuracy > 100) { measuredAccuracy = 100; } else { measuredAccuracy = accuracy; } String overpassLocation = String.format("around:%s,%s,%s", measuredAccuracy, latitude, longitude); String nwr = "%1$s[~\"^(%2$s)$\"~\".\"](%3$s);"; String types = "shop|amenity|leisure|tourism"; String node = String.format(nwr, "node", types, overpassLocation); String way = String.format(nwr, "way", types, overpassLocation); String relation = String.format(nwr, "relation", types, overpassLocation); return String.format("https: } QueryOverpass(Context context);   QueryOverpass(); @Override String getOverpassUri(double latitude, double longitude, float accuracy); @Override String queryOverpassApi(String urlString); @Override void processResult(String result); @Override void queryOverpass(double latitude, double longitude, float accuracy); String getType(JSONObject tags);  }