diff --git a/app/src/main/java/com/geeksville/mesh/ui/MapFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/MapFragment.kt index 75b6de300..bd34ad6c4 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/MapFragment.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/MapFragment.kt @@ -464,8 +464,8 @@ class MapFragment : ScreenFragment("Map"), Logging { R.drawable.baseline_location_on_white_24dp )!! .toBitmap() - pointLong = String.format("%.2f", it.longitude()) - pointLat = String.format("%.2f", it.latitude()) + pointLong = String.format("%.6f", it.longitude()) + pointLat = String.format("%.6f", it.latitude()) point = Point.fromLngLat(it.longitude(), it.latitude()) @@ -516,7 +516,7 @@ class MapFragment : ScreenFragment("Map"), Logging { private fun calculateCoordinate(degrees: Double, lat: Double, long: Double): Point { val deg = Math.toRadians(degrees) - val distancesInMeters = 16093.44// 10 miles + val distancesInMeters = 1609.344 * 10 // 1609.344 is 1 mile in meters -> multiplier will be user specified up to a max of 10 val radiusOfEarthInMeters = 6378137 val x = long + (180 / Math.PI) * (distancesInMeters / radiusOfEarthInMeters) * cos( @@ -527,18 +527,6 @@ class MapFragment : ScreenFragment("Map"), Logging { return Point.fromLngLat(x, y) } - /* - if (this::point.isInitialized) { - if (it.latitude() == point.latitude() && it.longitude() == point.longitude()) { - mapView?.getMapboxMap()?.getStyle()?.let { style -> - style.removeStyleImage(userPointImageId) - style.removeStyleSource(userTouchPositionId) - style.removeStyleLayer(userTouchLayerId) - } - } - } - */ - private fun updateStylePackDownloadProgress( progress: Long, max: Long, @@ -582,12 +570,12 @@ class MapFragment : ScreenFragment("Map"), Logging { if (this::pointLat.isInitialized && this::pointLat.isInitialized) { val latText = mapDownloadView.findViewById(R.id.longitude) - "Lat: $pointLong".also { + "Lon: $pointLong".also { latText.text = it View.VISIBLE.also { latText.visibility = View.VISIBLE } } val longText = mapDownloadView.findViewById(R.id.latitude) - "Long: $pointLat".also { + "Lat: $pointLat".also { longText.text = it View.VISIBLE.also { longText.visibility = View.VISIBLE } } @@ -646,9 +634,7 @@ class MapFragment : ScreenFragment("Map"), Logging { .center(point) .build(), MapAnimationOptions.mapAnimationOptions { duration(1000) }) //debug(userStyleURI) - it?.loadStyleUri(mapView?.getMapboxMap()?.getStyle()?.styleURI.toString()) { - - } + it?.loadStyleUri(mapView?.getMapboxMap()?.getStyle()?.styleURI.toString()) } // Open up Downloaded Region managers mapView?.annotations?.createCircleAnnotationManager()?.create(