mirror of
https://github.com/ev-map/EVMap.git
synced 2026-05-19 04:16:24 -04:00
OSM: implement address
This commit is contained in:
@@ -93,7 +93,7 @@ data class OSMChargingStation(
|
||||
"openstreetmap",
|
||||
getName(),
|
||||
Coordinate(lat, lon),
|
||||
null, // TODO: Can we determine this with overpass?
|
||||
getAddress(),
|
||||
getChargepoints(),
|
||||
tags["network"],
|
||||
"https://www.openstreetmap.org/node/$id",
|
||||
@@ -117,6 +117,19 @@ data class OSMChargingStation(
|
||||
true,
|
||||
)
|
||||
|
||||
private fun getAddress(): Address? {
|
||||
val city = tags["addr:city"]
|
||||
val country = tags["addr:country"]
|
||||
val postcode = tags["addr:postcode"]
|
||||
val street = tags["addr:street"]
|
||||
val housenumber = tags["addr:housenumber"] ?: tags["addr:housename"]
|
||||
return if (listOf(city, country, postcode, street, housenumber).any { it != null }) {
|
||||
Address(city, country, postcode, "$street $housenumber")
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name for this charging station.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user