diff --git a/src/Logic/GeoOperations.ts b/src/Logic/GeoOperations.ts index 86743b22c..0cd7dd658 100644 --- a/src/Logic/GeoOperations.ts +++ b/src/Logic/GeoOperations.ts @@ -908,9 +908,11 @@ export class GeoOperations { } /** - * GeoOperations.distanceToHuman(52.8) // => "50m" + * GeoOperations.distanceToHuman(52.3) // => "50m" * GeoOperations.distanceToHuman(2800) // => "2.8km" * GeoOperations.distanceToHuman(12800) // => "13km" + * GeoOperations.distanceToHuman(128000) // => "130km" + * * * @param meters */ @@ -924,7 +926,7 @@ export class GeoOperations { } if (meters >= 10000) { - const km = Utils.roundHuman(meters / 1000) + const km = Utils.roundHuman(Math.round(meters / 1000)) return km + "km" } diff --git a/src/Logic/Geocoding/CoordinateSearch.ts b/src/Logic/Geocoding/CoordinateSearch.ts index 84fddb452..2d972604a 100644 --- a/src/Logic/Geocoding/CoordinateSearch.ts +++ b/src/Logic/Geocoding/CoordinateSearch.ts @@ -24,18 +24,18 @@ export default class CoordinateSearch implements GeocodingProvider { * const ls = new CoordinateSearch() * const results = await ls.search("https://www.openstreetmap.org/search?query=Brugge#map=11/51.2611/3.2217") * results.length // => 1 - * results[0] // => {lat: 51.2611, lon: 3.2217, display_name: "lon: 3.2217, lat: 51.2611"} + * results[0] // => {lat: 51.2611, lon: 3.2217, display_name: "lon: 3.2217, lat: 51.2611", "category": "coordinate","source": "coordinateSearch"} * * const ls = new CoordinateSearch() * const results = await ls.search("https://www.openstreetmap.org/#map=11/51.2611/3.2217") * results.length // => 1 - * results[0] // => {lat: 51.2611, lon: 3.2217, display_name: "lon: 3.2217, lat: 51.2611"} + * results[0] // => {lat: 51.2611, lon: 3.2217, display_name: "lon: 3.2217, lat: 51.2611", "category": "coordinate","source": "coordinateSearch"} * * const ls = new CoordinateSearch() * const results = await ls.search("51.2611 3.2217") * results.length // => 2 - * results[0] // => {lat: 51.2611, lon: 3.2217, display_name: "lon: 3.2217, lat: 51.2611"} - * results[1] // => {lon: 51.2611, lat: 3.2217, display_name: "lon: 51.2611, lat: 3.2217"} + * results[0] // => {lat: 51.2611, lon: 3.2217, display_name: "lon: 3.2217, lat: 51.2611", "category": "coordinate", "source": "coordinateSearch"} + * results[1] // => {lon: 51.2611, lat: 3.2217, display_name: "lon: 51.2611, lat: 3.2217", "category": "coordinate", "source": "coordinateSearch"} * */ async search(query: string, options?: GeocodingOptions): Promise {