Nominatim
This commit is contained in:
@@ -38,12 +38,16 @@ abstract class NavigationRepository {
|
||||
}
|
||||
|
||||
fun searchPlaces(search: String, location: Location): String {
|
||||
val box = calculateSquareRadius(location.latitude, location.longitude, 800.0)
|
||||
val box = calculateSquareRadius(location.latitude, location.longitude, 50.0)
|
||||
val viewbox = "&bounded=1&viewbox=${box}"
|
||||
return fetchUrl(
|
||||
var result = fetchUrl(
|
||||
"${nominatimUrl}search?q=$search&format=jsonv2&addressdetails=true$viewbox",
|
||||
true
|
||||
false
|
||||
)
|
||||
if (result == "[]") {
|
||||
result = fetchUrl("${nominatimUrl}search?q=$search&format=jsonv2&addressdetails=true", false)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
fun reverseAddress(location: Location): String {
|
||||
@@ -67,7 +71,7 @@ abstract class NavigationRepository {
|
||||
}
|
||||
})
|
||||
}
|
||||
Log.d("fetchUrl", url)
|
||||
Log.d("NavigationRepository", url)
|
||||
val httpURLConnection = URL(url).openConnection() as HttpURLConnection
|
||||
httpURLConnection.setRequestProperty(
|
||||
"Accept",
|
||||
|
||||
Reference in New Issue
Block a user